Thread: small but odd!
View Single Post
Old 11-30-2005, 10:36 PM   #9 (permalink)
mgoldb2
 
Super Techie

Join Date: Jun 2005

Posts: 274

mgoldb2

Default

Quote:
Originally posted by i_learn
[B]thanks all of you, but i got it last night, mgoldb2, the second one is not 16 and 7 but 18 and 7, check it out,
I just ran it the computer gave me 16 and 7

Quote:
q=++j + ++j + j++;
9 and 4 because both are done before calculation so you get 3+3 then the other is done afterward so you get 6+3 and the total is 9 and 4

In this case it is 3+3+3. that dont mean that it always work out having all the number the same.

You got to remember the computer think of it like this

q=((++j + ++j) + j++);
so each quwation in a parthies is done first and if it a J++ afterward it increases it but it does NOT wait till the end of all equtions.

acturally maybe if I showed it this way it would make more sence
q=++j + ++j + j++ is the same as
q=++j + ++j
q=q + j++
mgoldb2 is offline