2 votes 2 votes int main(){ int i=5,j; j=++i + ++i + ++i; printf("%d %d",i,j); return 0; } https://gateoverflow.in/?qa=blob&qa_blobid=15560219953750733487 please explain how j = 22 comes in output?? Programming in C programming-in-c output interview + – indrajeet asked Jul 19, 2016 indrajeet 4.1k views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments Kapil commented Jul 20, 2016 reply Follow Share @Manojk, sir, these type of questions are undefined behaviour... answer can be 36 or 42... they dont hv a particular answer.. 2 votes 2 votes ManojK commented Jul 20, 2016 reply Follow Share yes . 0 votes 0 votes dd commented Jul 20, 2016 i edited by dd Jul 20, 2016 reply Follow Share yes ambiguity....in c99 strict it is giving 36 and in later version or in gcc giving 42 // thanks sir anyway learned about sequence point error 3 votes 3 votes Please log in or register to add a comment.
–1 votes –1 votes the answer this program is 8,22 explanation: As per the program i=5 j=++i + ++i + ++i (i.e., pre-increament=6+8+8) http://www.tutorialspoint.com/compile_c_online.php , https://www.codechef.com/ide j=22 and a=8 jaiganeshcse94 answered Jul 21, 2016 • edited Jul 22, 2016 by jaiganeshcse94 jaiganeshcse94 comment Share Follow See all 0 reply Please log in or register to add a comment.