Computer Concept & Programming In C - Unit IV - 20

 {
   while(temp -> next != NULL)
     {
       printf("%d-->",temp ->info);
       temp = temp -> next;
     }
   printf("%d",temp -> info);
   printf("-->*\n");
  }
  else
  {
    printf("List is Empty");
    printf("-->*\n");
  }
}
int search_node(struct node **h, int num)
{
 int i = 0;
 struct node *temp = NULL;
 temp = (*h);
 if(temp -> info == num)
   {
    printf("\n Number is present at the head");
    return 0;
   }
 else
 {
   do
    {
      if(temp -> info == num)
break;
      else
{
 i = i + 1;
 temp = temp -> next;
}
     }
    while(temp -> next != NULL);
    if((temp -> next == NULL) && (temp -> info != num))
      {
printf("\n Number is not present in the list.");
return NULL;
      }
     else
      {
       return i;
      }
 }
}

struct node* create_node(void)
{
 struct node *tmp = NULL;
 tmp =(struct node*)( malloc(sizeof(struct node)));
 if(tmp != NULL)
  return tmp;
 else
 {
  printf("\nMemory is not Free.Press any key to continue");
  getch();
  return NULL;
 }
}