Re: assigning values

  • From: "Littlefield, Tyler" <compgeek13@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 16 Sep 2007 16:50:42 -0600

you are assigning ++x to y.
Thanks,
Tyler Littlefield.
Vertigo head coder
"My programs don't have bugs, just randomly added features."
msn: compgeek134@xxxxxxxxxxx
email: compgeek13@xxxxxxxxx
aim: st8amnd2005
skype: st8amnd127
----- Original Message ----- From: "Daniel Dalton" <daniel.dalton47@xxxxxxxxx>
To: <ProgrammingBlind@xxxxxxxxxxxxx>
Sent: Sunday, September 16, 2007 4:08 PM
Subject: assigning values


Hi,

I have worked out that the following will assign 12 to x and 12 to y:
int x =11, y;
y = ++x;
So why is x incremented when we are assigning x to y?
Like for example the following wouldn't change x:
y =x+1;
So does ++ behave different to + and then a variable or number?
Sorry if this doesn't make a lot of sense.
Basically I am asking.
How come when using ++ x is incremented but when using x+1 x doesn't change.
Any help is greatly appreciated.

--
Daniel Dalton

http://members.iinet.net.au/~ddalton/
daniel.dalton47@xxxxxxxxx
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: