Project 1 - Creation of user defined data type to implement the user interfaces for working with ‘Set’ (Mathematical Set theory) using Linked List
in linkedlist add one node and delete one node ? #offline batcah
#include<stdio.h>
#include<stdlib.h>
struct node
{
int value;
struct node *next;
};
void answer(struct node *data);
int main()
{
struct node *head;
struct node *temp;
struct node *one = NULL;
struct node *two = NULL;
struct node *three = NULL;
one= malloc(sizeof(struct node));
two= malloc(sizeof(struct node));
three= malloc(sizeof(struct node));
printf("one->value =");
scanf("%d",&one->value);
printf("two->value =");
scanf("%d",&two->value);
printf("three->value =");
scanf("%d",&three->value);
one->next = two;
two->next = three;
three->next = NULL;
head = one;
answer(head);
printf("\n");
struct node * four;
four = malloc(sizeof(struct node));
printf("four->value ");
scanf("%d",&four->value);
three->next = four;
four->next = NULL;
answer(head);
printf("\n");
temp = head;
head = head->next;
free(temp);
head = two;
answer(head);
}
void answer(struct node *data)
{
while (data != NULL)
{
printf("%d",data->value);
data = data->next;
}
}