i got final tomorrow & stuck in this question .
Let's say ( c++ )
x = 1;
cout << ++x + ++x; // this gives me equals to 6 !
isn't it suppose to be 5 ? ( 2 + 3 ) i'm lost , any help would be truly appreciated .
i got final tomorrow & stuck in this question .
Let's say ( c++ )
x = 1;
cout << ++x + ++x; // this gives me equals to 6 !
isn't it suppose to be 5 ? ( 2 + 3 ) i'm lost , any help would be truly appreciated .
It's like :
the first ++x = 2
so now x=2
next ++x = 3
now x=3
so out = 3 + 3 = 6
because you are using the same variable so it will be applied to both the x.