-
A lil confused
Need to know how the following code would function...
Code:
#include<stdio.h>
int main()
{
int i=7;
printf("%d",i++*i++);
}
for the above mentioned the output is 56
if i were to change it to still the same output
Code:
printf("%d",++i*i++)
outputs it as 64
Cant figure out how its going about executing the statement, would appreciate help on this.
-
http://c-faq.com/expr/index.html
It's undefined.
In short, if you modify the same variable twice, or modify and read the variable, then all bets are OFF as to what actually happens.
Follow that link to further read up on something called "Sequence Points".