3 votes 3 votes What is the output of the program void main() { int i,j,k; i=2; j=4; k=i++>j&2; printf("%d\n",k); if(++k && ++i<--j|| i++) { j=++k; } printf(" %d %d %d",i,-j--,k); getch(); } A. 4,-3,2 B. 5,-3,2 c. 4,-2,2 D. 5,-2,2 suvasish pal asked Aug 22, 2017 suvasish pal 1.9k views answer comment Share Follow See 1 comment See all 1 1 comment reply Hemant Parihar commented Aug 22, 2017 reply Follow Share 0 4, -2, 2. For the first printf, k will be printed as 0 because (i++ > j) value is 0 which is bitwise And with 2. So final value is 0. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes output of this program would be 0,5,-2,2. For k=i++>j&2; the condition is false so k=0 so first printf will give 0 sandeepjkh answered Aug 22, 2017 sandeepjkh comment Share Follow See all 2 Comments See all 2 2 Comments reply suvasish pal commented Aug 23, 2017 reply Follow Share @ sandeepjkh i= 4 or 5? 0 votes 0 votes suvasish pal commented Aug 23, 2017 reply Follow Share @Hemant Parihar if(++k && ++i<--j || i++) here the order of precedence is < , && ,|| then how the expression eveluted? 0 votes 0 votes Please log in or register to add a comment.