+ 1

What is the point of num++? Can someone please explain what will happen if i dont write num++?

please

2nd Dec 2016, 6:13 AM
sham2222
sham2222 - avatar
2 Antworten
+ 4
num++ is a simple way to write "num=num+1" It's a common piece of code often use in loops and everywhere you need a step-by-step increment of a int variable. If you miss to increment the check value in a loop you can have your program stuck in an infinite loop Example: int x = 0; while (x < 5) { cout << x << endl; // This and the next line are not executed // x++; }
2nd Dec 2016, 6:26 AM
Antonio Andriollo
Antonio Andriollo - avatar
- 1
thanks a lot 😊😊
2nd Dec 2016, 7:03 AM
sham2222
sham2222 - avatar