0
Can anybody explain this program?
#include<stdio.h> int main() { int a=0; a=a++ + a++ - a++ + ++a; printf("%d\n", a); return 0; }
1 Answer
0
int a=0; //Declare "a" and initialize it to 0
a=a++ + a++ - a++ + ++a;
•++a : First increment, then use it
•a++ : Use the value, then increment
So...
a = 0 + 1 - 2 + 4
printf("%d\n", a); //prints 3 + line break