title: c++ debugging return 0 back to variable
body: <p>I am new to C++ and I've been learning how a program is executed. I am working on this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void sayHello() {
      cout &lt;&lt; "Hello world!" &lt;&lt; endl;
  }
  
  void greet(string name) {
      cout &lt;&lt; "Hello " &lt;&lt; name &lt;&lt; ", how are you?" &lt;&lt; endl;
  }
  
  int main()
  {
      sayHello();
      int a = 10;
      string name = "Johan";
      greet(name);
      return 0;
  }
  </code></pre>
  
  <p>I debugged this code in Code Blocks IDE. When it reached the <code>return 0</code> statement, the yellow arrow (step into mode) returned to the <code>string name</code> statement and then it went to the return statement again to finish the debugging. I thought it is related to freeing memory, but why didn't it go to the <code>int a = 10</code>?</p>
  
  <p>Is it normal? What did the debugger do? Shouldn't the debugger go to the closing bracket directly?</p>
  
  <p>Thank you very much.</p>