title: What happens in assembly language when you call a method/function?
body: <p>If I have a program in C++/C that (language doesn't matter much, just needed to illustrate a concept):</p>
  
  <pre><code>#include &lt;iostream&gt;    
  
  void foo() {
      printf("in foo");
  }
  
  int main() {
      foo();
      return 0;
  }
  </code></pre>
  
  <p>What happens in the assembly? I'm not actually looking for assembly code as I haven't gotten that far in it yet, but what's the basic principle? </p>