A journal for curious minds & hands-on builders.

Follow Marxtudor

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 story
Next story

Join the conversation.

Leave a Reply

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

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