Possible Duplicate:
Undefined Behavior and Sequence Points
The variable i is changed twice, but is the next example going to cause an undefined behaviour?
#include <iostream>
int main()
{
    int i = 5;
    std::cout << "before i=" << i << std::endl;
    ++ i %= 4;
    std::cout << "after i=" << i << std::endl;
}
The output I get is :
before i=5
after i=2
 
     
    