← Back to Question List
C++ Code Walkthrough #41
Variable Shadowing in a Block
📄 Code
Read carefully — what does this print?1#include <iostream>2using namespace std;3int main() {4 int x = 1;5 {6 int x = 2;7 cout << x << " ";8 }9 cout << x << endl;10 return 0;11}