Added count feature

This commit is contained in:
SF
2026-07-29 12:04:10 +00:00
parent 4d9c36b471
commit c0a432b2e7
4 changed files with 19 additions and 0 deletions
BIN
View File
Binary file not shown.
+15
View File
@@ -41,3 +41,18 @@ int search(int value)
}
return 0;
}
int count()
{
int count = 0;
Node *temp = head;
while(temp != NULL)
{
count++;
temp = temp->next;
}
return count;
}
+1
View File
@@ -12,5 +12,6 @@ typedef struct Node
void insert(int data);
void display();
int search(int value);
int count();
#endif
+3
View File
@@ -21,6 +21,9 @@ int main()
{
printf("\nElement not found");
}
printf("\nTotal nodes = %d", count());
return 0;
}