title: What values are pushed onto stack during a function call?
body: <p>I am trying to modify the value of local variable through another called function, but I am not able to figure out what all values pushed onto the stack are.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void fun()
  {
    int i; 
    int *p=&amp;i; 
    int j; 
    for(j=0;*(p+j)!=10;j++);
    printf("%d",j);
    /* Stack Frame size is j int pointers. */ 
    *(p+j)=20; 
  }    
  
  main()
  {
    int i=10;
    fun();
    printf("\n %d \n",i);
  }
  </code></pre>
  
  <p>How exactly does <code>j</code> in <code>fun()</code> equal to <code>12</code>? I am trying to understand what values are pushed onto stack. More specifically, can we change the value of <code>i</code> which is in <code>main()</code> without using a <code>for</code> loop in <code>fun()</code> and is it possible to predict the value of <code>j</code> inside <code>fun()</code>?</p>