title: How and where does a function save the 'returned value of one function' before calling other functions inside its body?
body: <p>I wrote this code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int valFunc(int val){
       return val;
  }
  
  
  int main(){
       int a  = 5;
       int b = 7;
  
       printf("%d",valFunc(a)+valFunc(b));
  
       return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>Inside the <strong>printf()</strong> function of <strong>main()</strong>, after <strong>valFunc(a)</strong> gets called and returns the value as 5, where does the main function save this value 5 before calling <strong>valFunc(b)</strong>?</p>
  
  <p>I know that if this function was written like below, then it would have saved the returned values of the functions <strong>valFunc(5)</strong> and <strong>valFunc(7)</strong> in integer variables <strong>a</strong> and <strong>b</strong> respectively. :</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int valFunc(int val){
       return val;
  }
  
  
  int main(){
  
  
    int a = valFunc(5);
    int b = valFunc(7);
  
    printf("%d",a+b);
  
  
    return 0;
  }
  </code></pre>
  
  <p>But in the former code, I am unable to understand where does the function save the returned values? Does it create implicit variables and uses them to save its progress before calling other functions or is there some other mechanism? Please explain.</p>
  
  <p>Does it create any temporary variables to store these values on the <strong>runtime stack</strong> before calling the other functions? In the second code that I have written in the question, its clear that <strong>main()</strong> will store these values in <strong>a</strong> and <strong>b</strong> and put them on the runtime stack. But how <strong>main()</strong> will do this for the first code as there are no variables?</p>