29 is the answer
its 30 in gcc. Try it from right->left order.
yes from right to left it is 30 (6 + 7 + 7 (converted into 8) + 10)
btw can you give me the link to download gcc (I know this is not the right place but I really need it and you are right from right to left your answer is right while in left to right order my answers are right)
just google it.
@ geeksoul Actuallly the answer is 27 on gcc. Regarding GCC go check out this link http://www.mingw.org/category/wiki/download
@sunny210 might be result in gcc is 27 but according to right to left approach 30 is correct while according to left to right approach 29 is the best answer
Its 30. I tried it on gcc before posting it. Can you explain the order of evaluation in which the answer is 27?
output be 6
u r right manβ¦
Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
This is UB, check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
The code is UB. Check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
Code is UB. check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
Code exhibits UB.
code has UB. Check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
Code exhibits UB. Check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
Code has UB. Check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
No, the code has UB. Check Your program exhibits undefined behaviour so it may give 6 or 7 or 8 or something else as output. Best advice, never do this. http://discuss.codechef.com/questions/41774/post-increment-variable-i-and-assigned-it-to-the-same-variable-i-i?page=1#41822
it will not run on the modern compiler, bt will runinthe older ones.
When printf("%d",++x + ++x); is executed , ++x + ++x will return the value 10(5+5). bt if one more ++x is added to it(++x + ++x + ++x), it will return 18.
Bt if after evaluting the printf ++x + ++x and the adding ++x will give 15.