Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int age[5] = { 19, 21, 17, 22, 33 };//Given array
- NODE *list;
- NODE *P;
- list = new(NODE);
- list->info = age[0];
- P = list;
- for (int i = 1; i < 5; i++)
- {
- P->next = new NODE;
- P->info = age[i];
- }
- P->next = NULL;
- while (P != NULL)
- {
- cout << P->info << "->";
- P = P->next;
- }
- cout << "NULL\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement