SlideShare a Scribd company logo
2
scanf ("%d", &cur?data);
cur?link= NULL;
first= cur;
last= cur;
}
voidinsert( )
{
intpos,c = 1;
cur = (structnode*)malloc(sizeof (structnode) );
printf (“ENTERTHE DATA :”);
scanf (“%d”,&cur?data);
printf(“ENTERTHE POSITION:”);
scanf (“%d”,&pos );
if ( (pos= = 1)&& (first!= NULL) )
{
cur?link= first;
first= cur;
}
else
{
next= first;
while (c< pos )
{
prev= next;
next= prev?link;
c++;
}
if ( prev= = NULL)
{
printf (“nINVALIDPOSITION n”);
}
else
{
cur?link= prev?link;
prev?link =cur;
if (cur?link= = NULL)
{
last= cur;
}
}
}
}
voiddelete()
{
intpos,c=1;
printf (“ENTERTHE POSITION :”);
scanf (“%d”,&pos);
if (first= = NULL)
{
printf (“nLIST IS EMPTY n”);
Most read
C Program To Implement Linked List Using Array Abstract Data Type
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
#include<stdlib.h>
voidcreate( )
voidinsert( )
voiddelete()
voiddisplay( )
struct node
{
intdata;
struct node *link;
};
struct node *first= NULL, *last= NULL, *next,*prev,*cur;
voidmain( )
{
intch;
clrscr( );
printf ("nSINGLYLINKED LIST");
do
{
printf ("n1.CREATE n 2.INSERTn 3.DELETE n 4.EXIT n");
printf ("nENTER YOUR CHOICE: ");
scanf ("%d",&ch );
switch(ch)
{
case 1:
create( );
display( );
break;
case 2:
insert( );
display( );
break;
case 3:
delete( );
display( );
break;
case 4:
exit(0);
}
} while( ch<= 3)
}
voidcreate( )
{
cur = ( struct node*)malloc(sizeof (structnode));
printf ("nENTER THE DATA:");
scanf ("%d", &cur?data);
cur?link= NULL;
first= cur;
last= cur;
}
voidinsert( )
{
intpos,c = 1;
cur = (structnode*)malloc(sizeof (structnode) );
printf (“ENTERTHE DATA :”);
scanf (“%d”,&cur?data);
printf(“ENTERTHE POSITION:”);
scanf (“%d”,&pos );
if ( (pos= = 1)&& (first!= NULL) )
{
cur?link= first;
first= cur;
}
else
{
next= first;
while (c< pos )
{
prev= next;
next= prev?link;
c++;
}
if ( prev= = NULL)
{
printf (“nINVALIDPOSITION n”);
}
else
{
cur?link= prev?link;
prev?link =cur;
if (cur?link= = NULL)
{
last= cur;
}
}
}
}
voiddelete()
{
intpos,c=1;
printf (“ENTERTHE POSITION :”);
scanf (“%d”,&pos);
if (first= = NULL)
{
printf (“nLIST IS EMPTY n”);
}
else if (pos= = 1&& first?link== NULL)
{
printf(“Ndeletedelementis%dn”,cur?data);
free(cur);
}
else
{
next= first;
while (c< pos )
{
prev= next;
next= next?link;
c++;
}
prev?link =next?link;
next?link=NULL;
if (next= = NULL)
{
printf (“nINVALIDPOSITION n“);
}
else
{
printf (“nDELETED ELEMENT IS%dn”,next?data);
free (next);
if(prev?link== NULL)
{
last= prev;
}
}
}
}
voiddisplay( )
{
cur = first;
while (cur!= NULL)
{
printf (“n%d”,cur?data);
cur = cur?link;
}
}
C Program to implement List ADT using Arrays
#include<stdio.h>
#include<conio.h>
#define MAX 10
void create();
void insert();
void deletion();
void search();
void display();
int a,b[20], n, p, e, f, i, pos;
void main()
{
//clrscr();
int ch;
char g='y';
do
{
printf("n main Menu");
printf("n 1.Create n 2.Delete n 3.Search n 4.Insert n 5.Displayn 6.Exit n");
printf("n Enter your Choice");
scanf("%d", &ch);
switch(ch)
{
case 1:
create();
break;
case 2:
deletion();
break;
case 3:
search();
break;
case 4:
insert();
break;
case 5:
display();
break;
case 6:
exit();
break;
default:
printf("n Enter the correct choice:");
}
printf("n Do u want to continue:::");
scanf("n%c", &g);
}
while(g=='y'||g=='Y');
getch();
}
void create()
{
printf("n Enter the number of nodes");
scanf("%d", &n);
for(i=0;i<n;i++)
{
printf("n Enter the Element:",i+1);
scanf("%d", &b[i]);
}
}
void deletion()
{
printf("n Enter the position u want to delete::");
scanf("%d", &pos);
if(pos>=n)
{
printf("n Invalid Location::");
}
else
{
for(i=pos+1;i<n;i++)
{
b[i-1]=b[i];
}
n--;
}
printf("n The Elements after deletion");
for(i=0;i<n;i++)
{
printf("t%d", b[i]);
}
}
void search()
{
printf("n Enter the Element to be searched:");
scanf("%d", &e);
for(i=0;i<n;i++)
{
if(b[i]==e)
{
printf("Value is in the %d Position", i);
}
else
{
printf("Value %d is not in the list::", e);
continue;
}
}
}
void insert()
{
printf("n Enter the position u need to insert::");
scanf("%d", &pos);
if(pos>=n)
{
printf("n invalid Location::");
}
else
{
for(i=MAX-1;i>=pos-1;i--)
{
b[i+1]=b[i];
}
printf("n Enter the element to insert::n");
scanf("%d",&p);
b[pos]=p;
n++;
}
printf("n The list after insertion::n");
display();
}
void display()
{
printf("n The Elements of The list ADT are:");
for(i=0;i<n;i++)
{
printf("nn%d", b[i]);
}
}

More Related Content

What's hot (20)

Join operation
Join operationJoin operation
Join operation
Jeeva Nanthini
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
David Livingston J
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
Khuram Shahzad
 
Method overriding
Method overridingMethod overriding
Method overriding
Azaz Maverick
 
Call by value
Call by valueCall by value
Call by value
Dharani G
 
11 constructors in derived classes
11 constructors in derived classes11 constructors in derived classes
11 constructors in derived classes
Docent Education
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
Srajan Shukla
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
bhawna kol
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
Ashim Lamichhane
 
Kruskal's algorithm
Kruskal's algorithmKruskal's algorithm
Kruskal's algorithm
Raj Kumar Ranabhat
 
Circular queue
Circular queueCircular queue
Circular queue
Lovely Professional University
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
Kamal Acharya
 
Data Structure and Algorithms Arrays
Data Structure and Algorithms ArraysData Structure and Algorithms Arrays
Data Structure and Algorithms Arrays
ManishPrajapati78
 
Nested queries in database
Nested queries in databaseNested queries in database
Nested queries in database
Satya P. Joshi
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
Venkata.Manish Reddy
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
Central processing unit and stack organization r013
Central processing unit and stack organization   r013Central processing unit and stack organization   r013
Central processing unit and stack organization r013
arunachalamr16
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
Nilesh Dalvi
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Tree
khabbab_h
 

Similar to C program to implement linked list using array abstract data type (20)

One dimensional operation of Array in C- language
One dimensional operation of Array in C- language One dimensional operation of Array in C- language
One dimensional operation of Array in C- language
9096308941
 
C basics
C basicsC basics
C basics
MSc CST
 
Array imp of list
Array imp of listArray imp of list
Array imp of list
Elavarasi K
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
Sayantan Sur
 
Double linked list
Double linked listDouble linked list
Double linked list
Sayantan Sur
 
Single linked list
Single linked listSingle linked list
Single linked list
Sayantan Sur
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
Arkadeep Dey
 
ADA FILE
ADA FILEADA FILE
ADA FILE
Gaurav Singh
 
QueueUsingArray-1.pptxnansbsbssnsnxbxbhs
QueueUsingArray-1.pptxnansbsbssnsnxbxbhsQueueUsingArray-1.pptxnansbsbssnsnxbxbhs
QueueUsingArray-1.pptxnansbsbssnsnxbxbhs
abhinandpk2405
 
week-6x
week-6xweek-6x
week-6x
KITE www.kitecolleges.com
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
Bilal Mirza
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
Lakshmi Sarvani Videla
 
Data struture lab
Data struture labData struture lab
Data struture lab
krishnamurthy Murthy.Tt
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
manoj11manu
 
systems programming lab programs in c
systems programming lab programs in csystems programming lab programs in c
systems programming lab programs in c
Meghna Roy
 
Circular queue
Circular queueCircular queue
Circular queue
ShobhaHiremath8
 
C program
C programC program
C program
Komal Singh
 
C Programming lab
C Programming labC Programming lab
C Programming lab
Vikram Nandini
 
SaraPIC
SaraPICSaraPIC
SaraPIC
Sara Sahu
 
Ad

Recently uploaded (20)

operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptxSemi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
studyshubham18
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
Structure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS pptStructure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS ppt
Wahajch
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
SharinAbGhani1
 
First Review PPT gfinal gyft ftu liu yrfut go
First Review PPT gfinal gyft  ftu liu yrfut goFirst Review PPT gfinal gyft  ftu liu yrfut go
First Review PPT gfinal gyft ftu liu yrfut go
Sowndarya6
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank
Guru Nanak Technical Institutions
 
Research_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptxResearch_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptx
niranjancse
 
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdfIrja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptxSemi-Conductor ppt ShubhamSeSemi-Con.pptx
Semi-Conductor ppt ShubhamSeSemi-Con.pptx
studyshubham18
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
Structure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS pptStructure of OS ppt Structure of OsS ppt
Structure of OS ppt Structure of OsS ppt
Wahajch
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
02 - Ethics & Professionalism - BEM, IEM, MySET.PPT
SharinAbGhani1
 
First Review PPT gfinal gyft ftu liu yrfut go
First Review PPT gfinal gyft  ftu liu yrfut goFirst Review PPT gfinal gyft  ftu liu yrfut go
First Review PPT gfinal gyft ftu liu yrfut go
Sowndarya6
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
Research_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptxResearch_Sensitization_&_Innovative_Project_Development.pptx
Research_Sensitization_&_Innovative_Project_Development.pptx
niranjancse
 
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdfIrja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
Ad

C program to implement linked list using array abstract data type

  • 1. C Program To Implement Linked List Using Array Abstract Data Type #include<stdio.h> #include<conio.h> #include<alloc.h> #include<stdlib.h> voidcreate( ) voidinsert( ) voiddelete() voiddisplay( ) struct node { intdata; struct node *link; }; struct node *first= NULL, *last= NULL, *next,*prev,*cur; voidmain( ) { intch; clrscr( ); printf ("nSINGLYLINKED LIST"); do { printf ("n1.CREATE n 2.INSERTn 3.DELETE n 4.EXIT n"); printf ("nENTER YOUR CHOICE: "); scanf ("%d",&ch ); switch(ch) { case 1: create( ); display( ); break; case 2: insert( ); display( ); break; case 3: delete( ); display( ); break; case 4: exit(0); } } while( ch<= 3) } voidcreate( ) { cur = ( struct node*)malloc(sizeof (structnode)); printf ("nENTER THE DATA:");
  • 2. scanf ("%d", &cur?data); cur?link= NULL; first= cur; last= cur; } voidinsert( ) { intpos,c = 1; cur = (structnode*)malloc(sizeof (structnode) ); printf (“ENTERTHE DATA :”); scanf (“%d”,&cur?data); printf(“ENTERTHE POSITION:”); scanf (“%d”,&pos ); if ( (pos= = 1)&& (first!= NULL) ) { cur?link= first; first= cur; } else { next= first; while (c< pos ) { prev= next; next= prev?link; c++; } if ( prev= = NULL) { printf (“nINVALIDPOSITION n”); } else { cur?link= prev?link; prev?link =cur; if (cur?link= = NULL) { last= cur; } } } } voiddelete() { intpos,c=1; printf (“ENTERTHE POSITION :”); scanf (“%d”,&pos); if (first= = NULL) { printf (“nLIST IS EMPTY n”);
  • 3. } else if (pos= = 1&& first?link== NULL) { printf(“Ndeletedelementis%dn”,cur?data); free(cur); } else { next= first; while (c< pos ) { prev= next; next= next?link; c++; } prev?link =next?link; next?link=NULL; if (next= = NULL) { printf (“nINVALIDPOSITION n“); } else { printf (“nDELETED ELEMENT IS%dn”,next?data); free (next); if(prev?link== NULL) { last= prev; } } } } voiddisplay( ) { cur = first; while (cur!= NULL) { printf (“n%d”,cur?data); cur = cur?link; } }
  • 4. C Program to implement List ADT using Arrays #include<stdio.h> #include<conio.h> #define MAX 10 void create(); void insert(); void deletion(); void search(); void display(); int a,b[20], n, p, e, f, i, pos; void main() { //clrscr(); int ch; char g='y'; do { printf("n main Menu"); printf("n 1.Create n 2.Delete n 3.Search n 4.Insert n 5.Displayn 6.Exit n"); printf("n Enter your Choice"); scanf("%d", &ch); switch(ch) { case 1: create(); break; case 2: deletion(); break; case 3: search(); break; case 4: insert(); break; case 5: display(); break; case 6: exit(); break; default: printf("n Enter the correct choice:"); } printf("n Do u want to continue:::"); scanf("n%c", &g);
  • 5. } while(g=='y'||g=='Y'); getch(); } void create() { printf("n Enter the number of nodes"); scanf("%d", &n); for(i=0;i<n;i++) { printf("n Enter the Element:",i+1); scanf("%d", &b[i]); } } void deletion() { printf("n Enter the position u want to delete::"); scanf("%d", &pos); if(pos>=n) { printf("n Invalid Location::"); } else { for(i=pos+1;i<n;i++) { b[i-1]=b[i]; } n--; } printf("n The Elements after deletion"); for(i=0;i<n;i++) { printf("t%d", b[i]); } } void search() { printf("n Enter the Element to be searched:"); scanf("%d", &e); for(i=0;i<n;i++) { if(b[i]==e) { printf("Value is in the %d Position", i); } else { printf("Value %d is not in the list::", e); continue;
  • 6. } } } void insert() { printf("n Enter the position u need to insert::"); scanf("%d", &pos); if(pos>=n) { printf("n invalid Location::"); } else { for(i=MAX-1;i>=pos-1;i--) { b[i+1]=b[i]; } printf("n Enter the element to insert::n"); scanf("%d",&p); b[pos]=p; n++; } printf("n The list after insertion::n"); display(); } void display() { printf("n The Elements of The list ADT are:"); for(i=0;i<n;i++) { printf("nn%d", b[i]); } }