#include <iostream>
namespace first{
int x = 1;
}
namespace second{
int x = 2;
}
int main(){
int x = 0;
std::cout << x << std::endl;
std::cout << first::x << std::endl;
using namespace second;
std::cout << x << std::endl;
return 0;
}
This is the code that I was working with. In this code I was expecting 0 1 2 as an output but why am I getting 0 1 0 as the output ?
New contributor
Ryujin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.