+1

Why is the output of the following C code 10 41 ?

int main() { int e=5,f=0; f=(++e) + (++e) + (++e) + (++e) + (++e); printf("%d %d\n",e,f); return 0; } It should be 10 40 but it's coming out to be 10 41.

9/8/2019 3:48:49 PM

Rishu Kumar

1 Answer

New Answer

+1

Using ++ operator more times in single line is UNDEFINED. You never know what will come up, depends on compiler or compiler flags