I have a problem with one of my linked list display function. The function is as below.
I am just calling the function in one of the switch statement. But nothing is getting displayed. Please help me figure out where i am going wrong.
Code:
void display ()
{
data *cur_point;
cur_point = head;
if(cur_point = NULL)
{
printf("The list is empty");
}
else
{
while(cur_point != NULL)
{
printf("Name : %s \n Contact Number : %d \n",cur_point->name,cur_point->telno);
cur_point = cur_point -> nextp;
}
}
}
Change this:
To:
Voila! 🙂 (Clarification: You set cur_point to
NULLin your code instead of checking if it isNULL)