Posts

program to delete the element from linked list after the given value

program to delete the element from linked list after the given value. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define NULL 0 struct node  {   int data;   struct node *link;  }*start,*temp,*prev,*n1; void display(); void main()  {   int n,i;   char ch;   clrscr();   start=NULL;   prev=NULL;   while(1)    {     if(start==NULL)      {                 temp=(struct node*)malloc(sizeof(struct node));                 printf("\nEnter value for Node:- ");                 scanf("%d",&temp->data);               ...

program to delete the element from linked list after the given position

program to delete the element from linked list after the given position. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define NULL 0 struct node  {   int data;   struct node *link;  }*start,*temp,*prev,*n1; void display(); void main()  {   int n,i;   char ch;   clrscr();   start=NULL;   prev=NULL;     while(1)    {     if(start==NULL)      {                 temp=(struct node*)malloc(sizeof(struct node));                 printf("\nEnter value for Node :- ");                 scanf("%d",&temp->data);             ...

program in c to delete the element from linked list of last position element

W.A.P to delete the element from linked list of last position element. #include<stdio.h> #include<conio.h> #include<alloc.h> #define NULL 0 struct node { int data; struct node *link; }*start,*temp,*pre; void display(); void main() { int i,q,x; char ch; clrscr(); start=NULL; for(i=0;i<=1;i++) { if(start==NULL) { temp=(struct node*)malloc(sizeof(struct node)); printf("\nEnter value for node: -"); scanf("%d",&temp->data); start=temp; temp->link=NULL; } else { while(1) { printf("\nDo you want create one more node(Y/N):- "); fflush(stdin); scanf("%c",&ch); if(ch=='y' || ch=='Y') { temp->link=(struct node *)malloc(sizeof(struct node)); temp=temp->link; printf("\nEnter value for node: -"); scanf("%d",&temp->data); } else { temp->link=NULL; break; } } } } printf(...

Pogram to delete the element from linked list of first position element

Pogram to delete the element from linked list of first position element . #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i,p,j=0;  struct node  {   int data;   struct node *link;  }*temp,*start,*n,*prev;  clrscr();  start=null;  for(i=0;i<=1;i++)  {   if(start==null)   {    temp=(struct node *)malloc(sizeof(struct node));    printf("enter data:");    scanf("%d",&temp->data);    temp->link=null;    start=temp;    j++;   }   else   {    while(1)    {     printf("press n if you not want to add another node");     fflush(stdin);     c=getch();     if(c=='n'||c=='N')      break;   ...

Program to insert the element in linked list after the given value.

Program to insert the element in linked list after the given value. #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i,p,j=0;  struct node  {   int data;   struct node *link;  }*temp,*start,*n,*prev;  clrscr();  start=null;  for(i=0;i<=1;i++)  {   if(start==null)   {    temp=(struct node *)malloc(sizeof(struct node));    printf("enter data:");    scanf("%d",&temp->data);    temp->link=null;    start=temp;    j++;   }   else   {    while(1)    {     printf("press n if you not want to add another node");     fflush(stdin);     c=getch();     if(c=='n'||c=='N')      break;     else ...