Thread: small but odd!
View Single Post
Old 12-01-2005, 01:26 AM   #10 (permalink)
i_learn
 
True Techie

Join Date: Nov 2005

Posts: 115

i_learn

Default

how can it be?
i got 18 and 7 both ways, in theory and on the complier.......
let me see, j=1;
j++ + ++j + j++
will be q=6, j=4;(one pre inc, gives me j=2, and does that while on that expression, and 2 postincs makes j 4 after the expression is read)

then j++ + ++J + ++j;
similarly, 2 preincs, makes j 6, and that makes q 18, and one post inc makes j 7. my complier reutned 18 and 7 to me!!! i will check it again tho!
the order makes no difference, its the combination, that matters, u put a j++ + j++ + ++j or a j++ + ++j + j++ or a ++j + j++ + j++ the output will still be same, i dont understnad how brackets will help?
i_learn is offline