title: How to delete head node in linked list? C
body: <p>So I have a linked list stack as an opaque object in C. am passing in a head pointer pointer to the function. </p>
  
  <p>this is the code for the delete head function. am calling it pop</p>
  
  <pre><code>MY_STACK pop(MY_STACK* head) {  
      Node_ptr hHead = (Node_ptr)head;
      if (*head == NULL){
  
          printf("badness \n");
          return FAILURE;
      }
  
  
      hHead = hHead-&gt;next;
  
      return SUCCESS;
  }
  </code></pre>
  
  <p>this doesn't work. it doesn't delete the head node. I actually can. but the head node doesn't switch to next when I do that and the program crashes because no head lol. how do I switch the head to next. because its not working. this is a node pointer pointer. its a public version of the Node called <code>MY_STACK</code>. I don't know how familiar you are with opaque object but for this am required to do it like this. I cant just put eveythign together I know how to do head delete with that but here its not working</p>
  
  <p>this is MY_STACK header file. Node_ptr is the private version which holds the same things + data and next fields. I have to cast MY_sTACK to Node_ptr to access those things.</p>
  
  <pre><code>    #ifndef MY_STACK_H
  #define MY_STACK_H
  
  #include "my_status.h"
  
  enum boolean {FALSE, TRUE};
  typedef enum boolean Bool;
  
  struct my_stack_public;
  typedef struct my_stack_public* MY_STACK;
  
  struct my_stack_public
  {
      void (*destroy)(MY_STACK* phMy_stack);
      Status (*push)(MY_STACK* hMy_stack, char item);
      Status (*pop)(MY_STACK* hMy_stack);
      char (*top)(MY_STACK hMy_stack);
      Bool (*empty)(MY_STACK hMy_stack);
  };
  
  MY_STACK my_stack_init_default(void);
  
  #endif
  </code></pre>
  
  <p>I have an insert function which works. it changes the head. but for some reason the pop function doesn't do it</p>