Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv28-Apr-13 22:11
N8tiv28-Apr-13 22:11 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
harold aptroot28-Apr-13 22:20
harold aptroot28-Apr-13 22:20 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv28-Apr-13 22:35
N8tiv28-Apr-13 22:35 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
harold aptroot28-Apr-13 22:42
harold aptroot28-Apr-13 22:42 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv28-Apr-13 22:54
N8tiv28-Apr-13 22:54 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff28-Apr-13 23:39
mveOriginalGriff28-Apr-13 23:39 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv28-Apr-13 23:47
N8tiv28-Apr-13 23:47 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff29-Apr-13 0:33
mveOriginalGriff29-Apr-13 0:33 
It does. But since you don't use "y" in the second expression that doesn't have any effect. Changing the value in "y" doesn't affect the value in "x" or "z" - it's like they are separate pockets. Adding coins to your shirt pocket doesn't affect the number of coins in either of your trouser pockets! Laugh | :laugh:
So:
C#
int x = 10;
int y = 100;
int z = y;
y = y++ + x;
// At this point, X = 10, y = 110 and z = 100;
z = ++z + x;
// At this point, X = 10, y = 110 and z = 111

The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv30-Apr-13 19:04
N8tiv30-Apr-13 19:04 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff30-Apr-13 21:57
mveOriginalGriff30-Apr-13 21:57 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv30-Apr-13 23:02
N8tiv30-Apr-13 23:02 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff30-Apr-13 23:36
mveOriginalGriff30-Apr-13 23:36 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv4-May-13 22:31
N8tiv4-May-13 22:31 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff4-May-13 22:50
mveOriginalGriff4-May-13 22:50 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv4-May-13 23:02
N8tiv4-May-13 23:02 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff4-May-13 23:14
mveOriginalGriff4-May-13 23:14 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv4-May-13 23:48
N8tiv4-May-13 23:48 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff4-May-13 23:58
mveOriginalGriff4-May-13 23:58 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv5-May-13 0:04
N8tiv5-May-13 0:04 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff5-May-13 0:11
mveOriginalGriff5-May-13 0:11 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv5-May-13 0:17
N8tiv5-May-13 0:17 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv5-May-13 0:19
N8tiv5-May-13 0:19 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv5-May-13 0:05
N8tiv5-May-13 0:05 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
OriginalGriff5-May-13 0:21
mveOriginalGriff5-May-13 0:21 
GeneralRe: Incrementing and Decrementing - Just Trying to Understand Pin
N8tiv5-May-13 0:24
N8tiv5-May-13 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.