Added search feature

This commit is contained in:
SF
2026-07-29 11:55:22 +00:00
parent 9f333aa21c
commit 4d9c36b471
4 changed files with 26 additions and 0 deletions
BIN
View File
Binary file not shown.
+14
View File
@@ -27,3 +27,17 @@ void display()
temp=temp->next;
}
}
int search(int value)
{
Node *temp = head;
while(temp != NULL)
{
if(temp->data == value)
return 1;
temp = temp->next;
}
return 0;
}
+1
View File
@@ -11,5 +11,6 @@ typedef struct Node
void insert(int data);
void display();
int search(int value);
#endif
+11
View File
@@ -11,5 +11,16 @@ int main()
display();
int result = search(20);
if(result)
{
printf("\nElement found");
}
else
{
printf("\nElement not found");
}
return 0;
}