0
Cannot understand output for the following code!!please explain!!(in GCC compiler)
#include<stdio.h> int main() { int a=10,b; b=a++ + ++a; printf("%d,%d,%d,%d",b,a++,a,++a); }
2 Answers
+ 1
a=10
b = a++ + ++a
b gets the value of a(10) + a+1(12) = 22
a increments after it's use (11), then a increments before its use (12)
The output is 22,12,13,14
print b, then print a and increments it, then print a(incremented, 13) then increments a before it's use so print 14
0
tq..but when i compiled here( http://rextester.com/l/c_online_compiler_gcc) ..it shows different answer ..it gives 22,13,14,14..please help:)