what does it mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what does it mean?

such as a++ or a-- ++a or --a

12th Nov 2016, 5:31 PM
Rakibul Islam Sifat
Rakibul Islam Sifat - avatar
2 Answers
+ 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)
12th Nov 2016, 5:37 PM
Wen Qin
Wen Qin - avatar
+ 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
12th Nov 2016, 5:37 PM
Lynda May
Lynda May - avatar