Can anyone explain how the increment and decrement operators works in an expression? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain how the increment and decrement operators works in an expression?

For example If n=1 then n++ + --n + n++ - n-- = ?

3rd Jan 2018, 4:01 PM
Pulivarthi Mahesh
Pulivarthi Mahesh - avatar
2 Answers
+ 1
just remember a simple rule if it is preincrement then first increment the value and then use it and if it is postincrement then first use it then increment it.
3rd Jan 2018, 4:39 PM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar