C++ Quiz41 of 173
Difficulty:
⬅️ Prev: 109Quiz ID: 111Next: 112 ➡️

According to the C++23 standard, what is the output of this program?

#include <iostream>

int main() {
    int i=1;
    do {
        std::cout << i;
        i++;
        if(i < 3) continue;
    } while(false);
    return 0;
}
Hint

Where does continue jump to?

Reveal answer

1

Explanation

§[stmt.cont]¶1 in the standard:

The continue statement causes control to pass to the loop-continuation portion of the smallest such enclosing statement, that is, to the end of the loop.

⬅️ Prev: 109Quiz ID: 111Next: 112 ➡️