linked_list/linked_list1.cpp
// counting number of nodes in the linked list
// 1 iterative approach
counting number of nodes in the linked list
1 iterative approach
counting number of nodes in the linked list 1 iterative approach
int count_nodes(struct Node *p)
{
    int count = 0;
    while(p != NULL)
    {
        count++;
        p = p->next;
    }
    return count;
}
int count_nodes ( struct Node * p ) { int count = 0 ; while ( p != NULL ) { count ++ ; p = p -> next ; } return count ; }
counting number of nodes in the linked list
1 iterative approach
counting number of nodes in the linked list 1 iterative approach
// condition // return result