+ 3

Does incrementing the operator stores the value in the variable?

like a=9; Console.WriteLine(a++); will change the value of a to 10?

2nd Jan 2020, 9:11 AM
RAJAN RAI
RAJAN RAI - avatar
3 Respuestas
+ 4
As a++ is same as a=a+1 so yes it will change it's value. Position of "++" determines whether the value of 'a' must be used before or after the incrementing it a++ means use and then change ++a means change and then use
2nd Jan 2020, 9:57 AM
Arsenic
Arsenic - avatar
+ 3
I guess yes it does.
2nd Jan 2020, 9:12 AM
RAJAN RAI
RAJAN RAI - avatar
+ 2
Yes, It does. But in your case value will be printed first before it is increased. Means, First value of ( a ) will be printed Then it will become 10 To print the value of ( a ) as 10 you should use: Console.WriteLine(++a)
2nd Jan 2020, 9:41 AM
Gautam Raj
Gautam Raj - avatar