int j = sizeof(++i+ ++i); isnt this the same as j= (++i+ ++i) what is (3+1)+ (4+1)=9 or is sizeof something i dont know yet
my mistake could also be in ++i+ because the ++i and the + aren't separated it is increased again
Check IQOD #7 for a description on what sizeof is/does
Originally Posted by B1ackAnge1
Code:
void main()
{
int i = 3;
int j = sizeof(++i+ ++i);
printf("i="%d j=%d", i,j);
}
Errors:
printf has a " after i=
sizeof returns the size of whatever variable you stuff into it, which in the case of i is 4.
i think that i is not increased because its done in sizeof so it wouldnt be seen as something it had to increase right?
so i think the output would be i=3 j=4
the extra " was my typo so I removed it
It outputs i=3 j=4
I think
What does i+ do?
Hmmm no one has answered this yet? i=5 j=9
Correct? incorrect? Tell me. The anticipation is killing me! D:
i think that i is not increased because its done in sizeof so it wouldnt be seen as something it had to increase right?
And nope HD. I'm pretty dam sure it would increase. Just like in that recursion problem that gave me hell
Originally Posted by BooYa
What does i+ do?
same thing 1+1 does, adds them together.
Originally Posted by why06
same thing 1+1 does, adds them together.
Ah confusing, i thought it needed a space for that
i = 3 and j = 9
Code:
void main()
{
int i = 3;
int j = sizeof(++i+ ++i);
I don't understand is it saying
i = 3 and
j = i + i
j = 6
:S:S:S:S:S:S:S:S:S:S:S:S:S:S:S:S
i = 3 j = 8
lala's theorie
sizeof does mean that i isn't actually changing but is suggesting that it is changed so it would be j= (3+1) + (3+1) <---this is still 3 because it hasn't changed. if this is wrong the answer is i = 3 j = 9