Thursday, July 30, 2009

C program to insert new node at the beginning of a singly linked list..??

struct Node {


void *content;


struct Node *next;


};





void insert(struct Node **list, void *content) {


struct Node *newNode = (struct Node *) malloc(sizeof(struct Node));


newNode-%26gt;content = content;


newNode-%26gt;next = *list;





// update list pointer


*list = newNode;


}


No comments:

Post a Comment