I have a program that creates a linked list and is required to count the number of elements in the list. This is what I have thus far.
I get the following error on compilation.
Linker error] undefined reference to `listsize(listr ec)'
Please advise.
Code:
// code snipped per FAQ and Posting Guidelines
struct listrec* temp;
int main()
{
int sum = 0;
cout << "The list size is " << listsize(*temp);
}
int listsize(listrec *p)
{
struct listrec* temp = p;
int num=0;
do{
temp = temp -> next;
num++;
}while(temp!= NULL);
return num;
}
Linker error] undefined reference to `listsize(listr ec)'
Please advise.
Comment