title: Order of execution of constructors and destructors in c++
body: <p>i have c++ little code, with constructors and destructors.</p>
  
  <pre><code>#include &lt;iostream&gt; 
  using namespace std; 
  class K { 
  public: 
      K(){cout&lt;&lt; "3 ";} 
      ~K(){cout&lt;&lt; "1 ";} 
  }; 
  int main() 
  { 
      { 
          K a; 
          { 
              K b; 
          } 
          { 
              K c; 
          } 
      } 
      system("pause"); 
      return 0; 
  }
  </code></pre>
  
  <p><strong>problem:</strong>
  i don't understand why answer is:<strong>331311</strong></p>
  
  <p>and not: <strong>333111</strong>.</p>
  
  <p>i know that first running constructors and last destructors but inverted.</p>