Quote:
Originally posted by i_learn
[B]
int j=1,q;
q=j++ + ++j + j++;
printf("%d %d",q,j);
getch();
clrscr();
q=j++ + ++j + ++j;
printf("%d %d",q,j);
getch();
}
|
it not that difficult if you understand how it works
6 4
16 7
would be the out put
let me explain
++j increment J by 1 before operation
J++ increment J by 1 after operation
for example the first one
j++ + ++j + j++
first thing done is (j++ + ++j)
first number is incremented after secound one before so you get
1+2=3
now that it done with the operation J is increase one for the J++ so now j =3
3+3=6 (j++ is incremented after operation)
and after that all done J increase to 4
sorry if I was confusing am trying to be clear.