Thread: small but odd!
View Single Post
Old 11-30-2005, 04:06 PM   #2 (permalink)
office politics
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default

hmmm,

int j=1,q; // j=1 q=null

q=j++ + ++j + j++; // translates to q= 2 + 2 + 2 (2 cus of pre inc) and j now == 2
// j=4 (cus of post inc) and q= 6

....

q=j++ + ++j + j++; // translates to q= 5 + 5 + 5, j == 5
// j == 7 and q == 15

i could be wrong about the first time j appears though.
office politics is offline