0
what does it mean?
such as a++ or a-- ++a or --a
2 odpowiedzi
+ 6
a ++ or a-- is postfix. It will process the data before increasing/decreasing the amount.
For example :
b = a++;
'b' in the above case would be 'a', while 'a' will change to (a+1)
++a and --a is prefix. Meaning that they will decrease/increase the value first before processing data/commands.
For example :
b = ++a;
'b' in the above case would be (a+1), and 'a' would also be (a+1)
+ 2
a++ and ++a both stands for a = a+1
a-- and --a both stands for a = a-1
Difference between a++ and ++a:
x = 1
y = ++x //y=2, x=2
x = 1
y = x++ //y=1, x=2