0

Who can teach me increment and decrement operators?

I can't understand that subject.

30th Dec 2017, 8:23 AM
Maksat Sakenuly
5 Answers
+ 3
Increment operators are of two types : Postfix and Prefix operators. Postfix : a++, the variable a is increased by 1 after using it once. Prefix : ++a, the variable a is increased after using it. Decrement operators too are of the same two types. Postfix : a--, the variable a is decreased by 1 after using it once. Prefix: --a, the variable a is decreased by 1 before using it.
30th Dec 2017, 8:28 AM
Karan Kumar
Karan Kumar - avatar
30th Dec 2017, 8:31 AM
Karan Kumar
Karan Kumar - avatar
+ 1
Thank you Karan Kumar. I understand, I have gor one more question. How you can estimate a++ or ++a?
30th Dec 2017, 8:36 AM
Maksat Sakenuly
+ 1
In a++ the value is increased afterwards while in ++a the value is increased before using it.
30th Dec 2017, 1:50 PM
Karan Kumar
Karan Kumar - avatar
+ 1
You will get to know the estimation once you start practicing it. Most preferably via looping. Best of luck. Keep coding
30th Dec 2017, 1:51 PM
Karan Kumar
Karan Kumar - avatar