Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LList::insert(int num, int at)
- {
- node **pp = &root;
- for (; *pp && at; pp = &(*pp)->next, --at);
- if (at == 0)
- {
- node *t = new node(num);
- t->next = *pp;
- *pp = t;
- }
- else
- {
- std::cerr << "invalid index\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment