title: cannot change value in struct using pass by reference
body: <p>Hi everyone I am now implementing a dynamic size stack in C but get stuck in a problem... This is part of my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  typedef struct Node node;
  
  struct Node{    
    int value;
    node *above;
  };
  
  struct stack{
      node *root;
      node *top;
  };
  
  typedef struct stack stack;
  
  void stack_init(stack *s){
      s = (stack*) malloc(sizeof(stack));
      s-&gt;top=-1;
      s-&gt;root=-1;
      printf("%d %d\n", s-&gt;top, s-&gt;root);
  };
  
  int main(){
      stack s;
      stack_init(&amp;s);
      printf("%d %d\n", s.top, s.root);
  }
  </code></pre>
  
  <p>When I run the code the printf from stack_init give -1 -1 and the one from main give 70 8, while in my assumption they should be the same. What is the problem? Any help is appreciated!</p>