OK, never-mind my last posting. I didn't see the part about init'ing a to 5.
So I tried your operation:
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
int a, c;
a = 5;
c = a/++a;
cout << "a = " << a << "\tc = " << c << endl;
return 0;
}
I got a compiler warning about the operation on a (the '++a') being undefined
when I compiled the source. When I ran the exe, I got a = 6 and c = 1. I ran
the program for both '++a' and 'a++' and got the same result. My guess is the
compiler, when executing the increment, is not putting the new value for 'a' in
a separate space in memory, but incrementing the value in the space already
reserved for variable 'a'. Thus the increment is executed prior to the
division making both sides of the divisor equal values resulting in 1 after
executing the division operation. BTW, I use g++, the GCC C++ compiler. I
hope this helps solve your dilemma. Cheers.