0
What is the a++ for?
int a = 42; do { cout << a << endl; a++; // what is this for? The int will still be 42 but if you increase it by a++ why would it be 42? Wouldnât it be 43?? } while(a < 5); // Outputs 42
6 Answers
+ 5
a++ is post increment and it first store the value then increment so value is store in a is 42 and then the loop is terminated so final value of a become 42
for more information
https://www.sololearn.com/Discuss/407846/?ref=app
0
Wait so after the a++ , can I do count << a; then would it return 43
0
Thanks man!