Thursday, July 30, 2009

C program to insert a node at any location in singly linked list?

struct Node {


void *content;


struct Node *next;


};





// Add new node to the end of the list


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


struct Node *temp = list;


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


newNode-%26gt;content = content;





// find last node


while (temp-%26gt;next) temp = temp-%26gt;next;


temp-%26gt;next = newNode;


}

C program to insert a node at any location in singly linked list?
for this help you visit


http://webdesignehelp.in/

rosemary

No comments:

Post a Comment