typedef struct node { int data; struct stack *next; }NODE; typedef NODE *STACK; /* ... there are some code */ int main() { STACK *st; STACK p = (STACK)malloc(sizeof(STACK)); p->data = 8; if (empty(*st)) { p->next = NULL; *st = p; } else { p->next = *st; *st = p; } }
typedef struct node { int data; struct stack *next; }NODE; typedef NODE *STACK; /* ... there are some code */ void push(STACK *st, int value) { STACK p = (STACK)malloc(sizeof(STACK)); p->data = 8; if (empty(*st)) { p->next = NULL; *st = p; } else { p->next = *st; *st = p; } } int main() { STACK *st; push(st, 8); }
push()
push
pop
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)