I'm having trouble while implementing array of link list in c++. I made 2 functions , one insert and display. Can someone help ?
This is the main function
node* a[100],*b,*temp,*temp2;
for(int i=0;i<100;i++)
{
a[i]=NULL;;
}
insert_node(a,1,143);
display(a,1)
And this is insert function
void insert_node(node **q[100],int pos,int data)
{
node *temp,*temp2;
if(*q[pos]==NULL)
{
temp=new node;
temp->next=NULL;
temp->data=data;
*q[pos]=temp;
}
else
{
temp2=*q[pos];
while(temp2->next != NULL )
{
temp2=*q[pos];
temp2=temp2->next;
}
temp=new node;
temp->next=NULL;
temp->data=data;
temp2->next=temp;
}
}
and this is display function
void display(node **q[100], int pos)
{
node * temp;
temp=*q[pos];
cout<<"\n";
while(temp->next != NULL)
{
cout<<" "<<temp->data;
}
}
It gives error that
error: cannot convert 'node**' to 'node***' for argument '1' to 'void insert_node(node***, int, int)'
error: cannot convert 'node**' to 'node***' for argument '1' to 'void display(node***, int)