Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
#include<stdio.h>
void call(int,int,int);
int main(){
int a=10;
call(a,a++,++a);
return 0;
}
void call(int x,int y,int z){
printf("x=%d y=%d z=%d\n",x,y,z);
}
This code is giving me output of 12 11 12 when run it. Could someone explain exactly how this is happening?
The behaviour of your code is undefined since you’re changing
atwice between sequence points: