10 is printed out.Code:#include <stdio.h> int main(void) { int i = 5; printf("%d", g(&i)); } int g (int *x) { return (*x + *x++); }
But if you change the return statement to:
11 is printed out.Code:return (*x + *x+=1);
Can someone explain to me why "++" before or after *x doesn't work and why "+=1" does?
I always thought "++" and "+=1" were the same thing when used after a variable.