How does my code actually give a segmentation fault?
I'd like to keep TOS as a double pointer.
#include<stdio.h>
#include<stdlib.h>
typedef struct node_tag{
    int num;
    struct node_tag* next;
}NODE;
void push(int x, NODE **TOS){
    NODE* temp = (NODE*) malloc(sizeof(NODE));
    temp->num = x;
    temp->next = (*TOS);
    (*TOS) = temp;
}
int main(){
    NODE **TOS = NULL, *temp;
    printf("<<<Stack Push>>>\n");
    push(0, TOS);
    printf("%i\n", (*TOS)->num);
}
 
     
    