Explain the meaning of a++ and ++a ? In c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Explain the meaning of a++ and ++a ? In c++

can't understand this- a++ and ++a in c++

1st Aug 2017, 8:19 AM
Hritvik
Hritvik - avatar
3 Answers
+ 6
a++ is postfix ++a is prefix postfix example: a=5 b=a++ //result: a=6, b=5 prefix example: a=5 b=++a //result: a=6, b=6
1st Aug 2017, 8:31 AM
Amethyst Animion
Amethyst Animion - avatar
+ 12
@Davye: not keeping a running tally are u?
1st Aug 2017, 9:21 AM
jay
jay - avatar
+ 11
Extracting out from an answer by J.G. Already many similar questions... https://www.sololearn.com/Discuss/98759/postfix-and-prefix https://www.sololearn.com/Discuss/305422/x-and-x https://www.sololearn.com/Discuss/38565/prefix-postfix https://www.sololearn.com/Discuss/123619/prefix-and-postfix https://www.sololearn.com/Discuss/336732/what-is-the-difference-between-x-and-x https://www.sololearn.com/Discuss/208414/what-s-the-diffrence-between-x-and-x https://www.sololearn.com/Discuss/305422/x-and-x https://www.sololearn.com/Discuss/164544/x-x https://www.sololearn.com/Discuss/126856/what-is-the-differences-between-prefix-x-and-postfix-x-in-c https://www.sololearn.com/Discuss/194344/i-really-need-help-on-prefix-and-postfix-in-c https://www.sololearn.com/Discuss/160327/what-is-the-difference-between-x-x-x-and-x https://www.sololearn.com/Discuss/98959/who-can-please-explain-the-increment-operators-x-and-x-with-their-differences-didn-t-really-get-the https://www.sololearn.com/Discuss/69892/does-anyone-have-a-good-example-of-prefix-and-postfix-increments https://www.sololearn.com/Discuss/320637/diference-between-n-and-n https://www.sololearn.com/Discuss/212492/can-any-one-explain-about-prefix-and-postfix-operators-completely-with-an-example https://www.sololearn.com/Discuss/139296/will-anyone-please-clear-my-doubt-about-prefix-and-postfix https://www.sololearn.com/Discuss/158600/how-do-prefix-and-postfix-works-and-how-do-they-help-us-in-real-life-situation https://www.sololearn.com/Discuss/217288/what-is-the-difference-between-i-i https://www.sololearn.com/Discuss/252933/while-and-postfix-prefix https://www.sololearn.com/Discuss/67901/prefix-and-postfix-forms-of-increments https://www.sololearn.com/Discuss/119084/what-is-the-prefix-and-the-postfix https://www.sololearn.com/Discuss/63563/what-is-difference-between-prefix-and-postfix-increment-operator https://www.sololearn.com/Discuss/147409/prefix-postfix-in-a-for-loop-difference
1st Aug 2017, 8:30 AM
Dev
Dev - avatar