Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
I have heard that printf function executes from right to left and prints from left to right. By that convention, the following program should give 7,6,5. But it's giving 7,7,7 on my linux gcc compiler. Is it compiler dependent?
int i=5;
printf("%d %d %d\n",++i,++i,i);
Also, can we use cdecl/pascal keyword to change the order of execution of printf? If yes, how do we do that? I have been trying to do this but without success. Thanx in advance!