Quote:
Originally Posted by J65nko
How about trying this pre-increment variation
|
I initially had it using pre-increment. But, it switched between 0 and 1 and I wanted it to switch between 1 and 2 -- and I have bigger fish to fry in this project (the main point is to create a game AI system). It is working the way it should with
variable1 = (variable1 % 2) + 1;
.
I was just wondering why one version of the compiler incremented after the rest of the statement and the other did it in the middle. And thanks to ephemera's post, I seem to have gotten my answer.
It must just be a gcc quirk to allow non-standard C. Arrgh! C'mon pcc!