When I am doing my C++ project on this linked list, one of the problems I face is getting this error message on the output terminal:
main.cpp:(.text+0x4d): undefined reference to 'insert(Node*&, int)'
collect2 error: 1d returned 1 exit status
So here is my code:
#include <iostream>
using namespace std;
struct Node
{
    int data;
    Node *link;
};
typedef Node* nodePtr;
void insert(nodePtr& head, int data);
int main()
{
   nodePtr head;
   head = new Node;
   head->data = 20;
   head->link = NULL;
   insert (head, 30);
   nodePtr tmp;
   tmp = head;
   while(tmp->link != NULL)
   {
       cout << tmp->data <<endl;
       tmp = tmp->link;
   }
}
But to no avail. I just do no know where I am getting it wrong for it to not run properly.
 
    