What is the difference between a++ and ++a?
'++a' is pre-fix 'a++' is post-fix This just means that in '++a' the operation of incrementing 'a' is done BEFORE the 'a' is processed by a function (i.e. cout). In 'a++' the operation to increment is done AFTER 'a' is processed by a function (i.e. cout). cout << ++1 OUTPUT: 2 cout << 1++ OUTPUT: 1 Hope this helps! -bern
https://www.sololearn.com/Discuss/160327/?ref=app the increment operator works the same in the majority of languages.
yea like int i = 5; int k = 1; int a = i + k++ // a = 6 // k is now 2 vs int i = 5; int k = 1; int a = i + ++k // a = 7 // k is now 2
Thank you all