Added count feature
This commit is contained in:
BIN
Binary file not shown.
@@ -41,3 +41,18 @@ int search(int value)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int count()
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
Node *temp = head;
|
||||||
|
|
||||||
|
while(temp != NULL)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
temp = temp->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ typedef struct Node
|
|||||||
void insert(int data);
|
void insert(int data);
|
||||||
void display();
|
void display();
|
||||||
int search(int value);
|
int search(int value);
|
||||||
|
int count();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user