SlideShare a Scribd company logo
Array Implementation of List
#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()
{
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

TXT
Data Structures : array operations in c program
DOCX
C program to implement linked list using array abstract data type
DOC
Final ds record
DOCX
Circular queue
DOCX
array implementation
PPTX
Array menu
Data Structures : array operations in c program
C program to implement linked list using array abstract data type
Final ds record
Circular queue
array implementation
Array menu

What's hot (18)

PPTX
Structure
PPTX
C & Python Introduction
DOCX
basic programs in C++
PPTX
Double linked list
DOCX
One dimensional operation of Array in C- language
PDF
C언어 스터디 강의자료 - 1차시
DOCX
01 list using array
PPT
StackArray stack3
PPTX
Circular linked list
PPTX
Single linked list
PPTX
Double linked list
PPTX
DS- Stack ADT
PPTX
Stack using Linked List
PDF
Insertion sort
Structure
C & Python Introduction
basic programs in C++
Double linked list
One dimensional operation of Array in C- language
C언어 스터디 강의자료 - 1차시
01 list using array
StackArray stack3
Circular linked list
Single linked list
Double linked list
DS- Stack ADT
Stack using Linked List
Insertion sort
Ad

Similar to Array imp of list (20)

PPTX
stack.pptx
PPTX
Stack using Array
PDF
systems programming lab programs in c
PDF
Data Structure using C
DOCX
ADA FILE
DOC
C basics
DOCX
DataStructures notes
PDF
C programms
DOCX
C lab manaual
PPTX
Binary tree
PDF
Data Structure in C Programming Language
PPTX
Short Review of Stack
PPTX
QueueUsingArray-1.pptxnansbsbssnsnxbxbhs
DOCX
Practical File of C Language
DOCX
Hangman Game Programming in C (coding)
PDF
VTU Data Structures Lab Manual
PDF
PDF
C program
stack.pptx
Stack using Array
systems programming lab programs in c
Data Structure using C
ADA FILE
C basics
DataStructures notes
C programms
C lab manaual
Binary tree
Data Structure in C Programming Language
Short Review of Stack
QueueUsingArray-1.pptxnansbsbssnsnxbxbhs
Practical File of C Language
Hangman Game Programming in C (coding)
VTU Data Structures Lab Manual
C program
Ad

Recently uploaded (20)

PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
Geodesy 1.pptx...............................................
PPTX
Artificial Intelligence
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPT
Project quality management in manufacturing
PPTX
UNIT 4 Total Quality Management .pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Current and future trends in Computer Vision.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PPT on Performance Review to get promotions
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Geodesy 1.pptx...............................................
Artificial Intelligence
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Embodied AI: Ushering in the Next Era of Intelligent Systems
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Model Code of Practice - Construction Work - 21102022 .pdf
additive manufacturing of ss316l using mig welding
CYBER-CRIMES AND SECURITY A guide to understanding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Project quality management in manufacturing
UNIT 4 Total Quality Management .pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Current and future trends in Computer Vision.pptx
573137875-Attendance-Management-System-original
Safety Seminar civil to be ensured for safe working.
OOP with Java - Java Introduction (Basics)
PPT on Performance Review to get promotions
Operating System & Kernel Study Guide-1 - converted.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx

Array imp of list

  • 1. Array Implementation of List #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() { 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;
  • 2. 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++)
  • 3. { 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++; }
  • 4. 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]); } }