title: C linked list push function, just checking if this is correct
body: <p>So I'm just wondering if this push function, which pushes a new value to the top a linked list stack is correct</p>
  
  <pre><code>void push(node** hd, int v){
  node temp;
  temp = (node*)malloc(sizeof(node));
  temp -&gt; val = v;
  temp -&gt; next = *hd;
  *hd = temp;
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks in advance!</p>
  
  <p>Also I'm wondering how I would make a pop function, to pop the most recently pushed value off of the stack. </p>
  
  <p>The struct code looks like this by the way...</p>
  
  <pre><code>typedef struct nodeStruct
  {
  int val;
  struct nodeStruct* next;
  }node;
  
  typedef node* list;
  </code></pre>