increment and decrement operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

increment and decrement operators

How do they work? I am very confused about them.

28th Oct 2017, 2:03 PM
MBBS28
3 Answers
+ 1
x++ adds by one. x-- minuses by one. Stringing these together takes no effect, changing the order affects the order of operation. c++ would == c = c + 1; c-- would == c = c - 1; //Never use C--, it's the opposite of C++, being mathematically lower in status (crappier) than C++. If you increment after the variable, any mathematical permutation will increment the value of c or x after the beforehand stuff. If you pre-increment the variable, it increments first then continues. //The same principles apply to decrementation, etc... The order of crementing may affect the course of effect, for good or bad - thoroughly revise. :)
28th Oct 2017, 2:18 PM
ghostwalker13
ghostwalker13 - avatar
28th Oct 2017, 2:16 PM
Nanda Balakrishnan
0
https://www.sololearn.com/discuss/468369/?ref=app
28th Oct 2017, 2:17 PM
Nanda Balakrishnan