Linked list function to count the number of nodes

void count(struct node *start)
 {
      int count = 0;
      struct node *p=start;
      
      while(p!=NULL)    
      {
                    p=p->link;
                    count++;
      }
      printf("Number of nodes %d ", count);
}
Previous Post
Linked list C program
Next Post
Linked list search function

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

alert('dsf'); console.log("dsdsdsd");