Here a is variable : Purpose of a++ operator ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Here a is variable : Purpose of a++ operator ?

Guys i want to know the purpose a++ operator. Please answer me..

8th Sep 2020, 2:42 PM
born2code
born2code - avatar
7 Answers
+ 4
It is used to increment the value of variable *a* by one.
8th Sep 2020, 2:44 PM
Arsenic
Arsenic - avatar
+ 2
Both can be used to increment the value of *a* by 1. Find the difference here👇 https://www.geeksforgeeks.org/difference-between-increment-and-decrement-operators/
8th Sep 2020, 2:49 PM
Arsenic
Arsenic - avatar
+ 1
Very verry thanx for helping me
8th Sep 2020, 2:51 PM
born2code
born2code - avatar
+ 1
a++ uses the current value of a and then increments by 1 so if you print a++ you will get it's current value of a but the next time you print a++ you will see that its increased by 1 ++a increments the value by 1 and uses it. so if you print ++a you will notice that the value has increased by 1 instantly.
8th Sep 2020, 4:16 PM
D_Stark
D_Stark - avatar
0
I think ++a is used for increment
8th Sep 2020, 2:46 PM
born2code
born2code - avatar
0
Rankush that's why we call them as post increment and pre increment ,like ++a pre-increment,a++ post increment
8th Sep 2020, 3:10 PM
RuntimeERROR
RuntimeERROR - avatar
0
a++ is used for increment but it wouldnt return the increased variable immediately, But ++a would return the increment
10th Sep 2020, 12:35 PM
Chukwunonso Emmanuel Chukwumaeze
Chukwunonso Emmanuel Chukwumaeze - avatar