In C or C++, increment and decrement operator (++n
, --n
) are not performed when it is in a sizeof()
operator.
int n = 100;
int size_int = sizeof(++n);
std::cout<<n;
I have written this code and run the program. Of course, I think 101 will be showed for me.
But, n
was not 101, it was 100.
Why is that?