What will be printed out as a result of the following code execution?
#include <iostream>

using namespace std;

int main()
    int i = 0;

    while(i < 10)
        int i = 10;

    return 0;
int i=0 and int i=10 declarations are located in different scopes. i=10 is relevant inside the loop, and i=0 - outside the loop and for the loop itself.

Follow CodeGalaxy

Mobile Beta

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