S
Student911
Hello,
I read in a lecture that the output of the following code is 5 although
we would expect it to be 4.
///////////////////////////////////////
#define POW2(x)(x*x)
int main(){
int x=3;
std::cout<<POW2(x++)<<std::endl;
}
///////////////////////////////////////
I don't understand why the output will be 5 and I don't understand why
we would expect it to be 4. What I see is that it should be 9 or 16
since its POW.
Can someone explain that to me?
Thanks
I read in a lecture that the output of the following code is 5 although
we would expect it to be 4.
///////////////////////////////////////
#define POW2(x)(x*x)
int main(){
int x=3;
std::cout<<POW2(x++)<<std::endl;
}
///////////////////////////////////////
I don't understand why the output will be 5 and I don't understand why
we would expect it to be 4. What I see is that it should be 9 or 16
since its POW.
Can someone explain that to me?
Thanks