/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct chainLink * buildLIST() { chainLink *head[ARRAY_TOP]; makeNULL(head); head[ARRAY_TOP] = new chainLink; return head[0]; } void makeNULL(chainLink **newNode){ for(int a = 0; a < ARRAY_TOP; a++){ newNode[a] = new chainLink; newNode[a]->data = 0; newNode[a]->next = 0; } } struct chainLink * buildLIST() { chainLink *head[ARRAY_TOP]; makeNULL(head); head[ARRAY_TOP] = new chainLink; return head[0]; } void Push(struct chainLink* headRef[ARRAY_TOP], int data){ int key = 1; chainLink *head[ARRAY_TOP]; makeNULL(head); head[0]->data = data; head[0]->next = headRef[0]; headRef[0] = head[0]; } void pushNODES(int index, int number){ chainLink* head[ARRAY_TOP]; makeNULL(head); head[index] = buildLIST(); Push(head, number); }