What will be displayed on the console as a result of the program?
#include <iostream>
using namespace std;

int main() {
    int i = 0;

    switch(0) {
        for( ; i < 3 ; i++) {
            cout << i; case 0:;
        };
    };

    return 0;
}
Explanation
In a switch statement case is announcing the usual mark/label, that is not necessarily be located at the beginning of the expression. See also Duff's device.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes