1 votes 1 votes main ( ) { int a = 2, b, c; a* = b = c = 4; a = b = c; printf (“%d”, a); a = = (b = c); printf (“%d”, a); } What will be the output? Not able to understand !! Programming in C programming-in-c output + – Naveen Kumar 3 asked Jul 29, 2017 • edited Jul 10, 2019 by Cristine Naveen Kumar 3 723 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Hira Thakur commented Jul 29, 2017 reply Follow Share it's is 4,4?? 0 votes 0 votes Naveen Kumar 3 commented Jul 30, 2017 reply Follow Share Explain please.. 0 votes 0 votes Bhavisha commented Aug 2, 2017 reply Follow Share This would give compile time error. Initially a = 2 and b , c are not yet initialized. moving further in line 2 a* = b = c = 4; a*=b is shorthand for a = a*b. So, a*=b=c=4 implies a = a*b = c= 4; Considering the precedence "*" should be evaluated before "=" but "b" is not initialized yet. 0 votes 0 votes Rishabh Gupta 2 commented Aug 6, 2017 reply Follow Share @Bhavisha No. It is not giving any error. The output is 44 0 votes 0 votes Please log in or register to add a comment.
Best answer 3 votes 3 votes Ignore variable d, and values mentioned in block 1 for b and c are garbage values. saxena0612 answered Jul 29, 2017 • selected Jul 30, 2017 by Naveen Kumar 3 saxena0612 comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments saxena0612 commented Jul 30, 2017 reply Follow Share " a=(b==c);" : program does not have any statement like this rather if you are talking about a==(b=c) this statement in the program does not make any difference . 0 votes 0 votes Naveen Kumar 3 commented Jul 30, 2017 reply Follow Share thus, answer remains 44? 0 votes 0 votes saxena0612 commented Jul 30, 2017 reply Follow Share Yup ! I think so ! Compile it for better understanding ! Hope it helps 0 votes 0 votes Please log in or register to add a comment.