#include #include struct Node { int key; struct Node * next; }; struct Node * pushFront(int key, struct Node * oldListStart) { struct Node * newNode; newNode = (struct Node *)malloc(sizeof(struct Node)); newNode->key = key; newNode->next = oldListStart; return newNode; } int popFront(struct Node ** pListStart) { struct Node * newListStart; int returnKey = (*pListStart)->key; newListStart = (*pListStart)->next; free(*pListStart); *pListStart = newListStart; return returnKey; } //print list front-to-back void printList(struct Node * currentNode) { while(currentNode) { printf("%i ", currentNode->key); currentNode = currentNode->next; } } int main(int argc, char **argv) { struct Node * listStart = NULL; int tmp = 5; listStart = pushFront(89, listStart); while(tmp--) listStart = pushFront(tmp, listStart); tmp = popFront(&listStart); printf("popvalue : %i \n", tmp); printList(listStart); printf("hello world\n"); return 0; }