You are asked to implement the pop
and push
functions of the following stack interface :
struct node { struct node *next; char *name; };
Hints :
char *name
is also a pointer, memory must be allocated by using malloc(3) to copy the string on the stack.- Other useful commands: strncpy(3) and strlen(3).
- Do not forget to free all the allocated space when popping one element.