1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| typedef struct LinkList{ int d; struct LinkList *next; } List;
List *add_List(List* Head, int data){ List *newnode = (List*)malloc(sizeof(List)); newnode->d = data; newnode->next = NULL; if(Head == NULL) { Head = newnode; }else{ List *pT = Head; while (pT->next != NULL) { pT = pT->next; } pT->next = newnode; } return Head; }
|