Question: for (int i = 0; i < 5; i++) { cout < < i - postfix++: < < i < < endl; } for

for (int i = 0; i < 5; i++) {

cout << "i - postfix++: " << i << endl;

}

for (int i = 0; i < 5; ++i) {

cout << "i - prefix++: " << i << endl;

}

Hi, I've been struggle about the C++ prefix/postfix increment(decrement) operators...

Why do the prefix increment and postfix increment operators make no difference in the above two code snippets,

and does it happen on the while (do while) loop too?

How do I know if there'll be a change due to prefix or postfix?

Thank you! Upvote for detailed answer for sure!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!