title: C++ : multiple namespaces inside a function
body: <p>I am trying the below code, using multiple namespaces (changing namespaces) inside a function. I am not sure what is wrong, I am not even sure whether I can use like below, but did not find any contradicting evidence in my short browsing,  please let me know what is wrong:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  namespace standard_one
  {
          int i = 10;
  }
  
  namespace standard_two
  {
          int i = 40;
  }
  
  
  main()
  {
          using namespace standard_one;
          cout &lt;&lt; "value of i is " &lt;&lt; i &lt;&lt; endl;
  
          {
                  using namespace standard_two;
                  cout &lt;&lt; "value of i after namespace change is " &lt;&lt; i &lt;&lt; endl; // Compilation error here, compiler is complaining that "i" is undeclared
          }
  }
  </code></pre>