EXP1
EXP1
operations: Insert,
SOURCE CODE:
#include <stdio.h>
#include <stdlib.h>
int data;
} Node;
int main() {
while (1) {
printf("1. Insert\n");
printf("2. Display\n");
printf("3. Delete\n");
printf("4. Search\n");
EXPERIMENT NO-01 Implementing of Singly Linked List with their
operations: Insert,
printf("5. Count\n");
printf("6. Exit\n");
scanf("%d", &choice);
switch (choice) {
case 1:
scanf("%d", &value);
insert(&head, value);
break;
case 2:
display(head);
break;
case 3:
scanf("%d", &value);
delete(&head, value);
break;
case 4:
scanf("%d", &value);
if (result != NULL)
else
break;
EXPERIMENT NO-01 Implementing of Singly Linked List with their
operations: Insert,
case 5:
break;
case 6:
exit(0);
default:
return 0;
new_node->data = data;
new_node->next = NULL;
if (*head == NULL) {
*head = new_node;
} else {
temp = temp->next;
temp->next = new_node;
if (head == NULL) {
printf("List is empty.\n");
return;
head = head->next;
printf("NULL\n");
if (*head == NULL) {
return;
*head = temp->next;
free(temp);
return;
prev = temp;
temp = temp->next;
if (temp == NULL) {
return;
prev->next = temp->next;
free(temp);
if (head->data == data)
return head;
head = head->next;
return NULL;
int count = 0;
count++;
head = head->next;
return count;
OUTPUT: