Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
I found this piece of code, originally here:
#include <stdio.h>
int main()
{
int p = 0;
p = p++ + ++p;
printf("p=%d\n", p);
}
I guessed the output will be 2, but when I compiled the code and I execute it, the output was 3, why?