Added count feature
This commit is contained in:
BIN
Binary file not shown.
@@ -41,3 +41,17 @@ 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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#ifndef LINKEDLIST_H
|
#ifndef LINKEDLIST_H
|
||||||
#define LINKEDLIST_H
|
#define LINKEDLIST_H
|
||||||
|
|
||||||
@@ -11,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