Posts

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 ...

Program to insert the element in linked list after the given position

Program to insert the element in linked list after the given position. #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...

Program to insert the element in linked list at last position

Program to insert the element in linked list at last position.                               #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i;  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;   }   else   {    while(1)    {     printf("press n if you not want to add another node");     fflush(...

Program to insert the element in linked list at first position

Program to insert the element in linked list at first position. #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i;  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;   }   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     {  ...

Program in 'c' to create & display the linked list

Program in 'c' to create & display the linked list. #include<stdio.h> #include<conio.h> #include<alloc.h> #define null 0 void main() {  char c;  int i;  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;   }   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     {   ...