#include #include /* ------------------------ List element definition ------------------------ */ struct ListElem { int value; struct ListElem* next; }; int main(int argc, char *argv[]) { struct ListElem* head; // Head of list struct ListElem* p; // Help variable to allocate new list element head = NULL; // Empty list /* ======================================================== Insert at head technique: 1. create new list element p put values in the payload area... 2. make p point to first element in list 3. make head point to new list element ======================================================== */ p = malloc( sizeof(struct ListElem) ); // (1) p->value = 123; // Payload... p->next = head; // (2) head = p; // (3) }