1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
int main() {
int x = 10;
{
int y = 20;
std::cout << "Inside block: x = " << x << ", y = " << y << std::endl;
}
std::cout << "Outside block: x = " << x << std::endl;
// std::cout << "y = " << y << std::endl; // This would cause a compilation error
return 0;
}
Back to context