SlideShare a Scribd company logo
1 of 6
Array
A Menu Driven Program In C
Declarations And Main Function
#include<stdio.h>
#include<stdlib.h>
void insert(), delete_array(), display();
int array[5];
int count=-1;
int main()
{
int choice;
while(1)
{
printf("n---Array Menu---n");
printf("1. Insert.n");
printf("2. Delete.n");
printf("3. Display.n");
printf("4. Exit.n");
printf("Enter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1: insert();
break;
case 2: delete_array();
break;
case 3: display();
break;
case 4: exit(0);
default: printf("Invalid choice.");
}
}
}
Insert Function
void insert()
{
int position,data,i;
printf("Enter the position you want to insert: ");
scanf("%d",&position);
printf("Enter an integer value: ");
scanf("%d",&data);
position-=1;
if(count!=4)
{
if(position<=count+1)
{
for(i=count+1;i>position;i--)
{
array[i]=array[i-1];
}
count++;
array[position]=data;
display();
}
else
{
printf("Insertion not possible as there are only %d elements.",count+1);
}
}
else
{
printf("Array overflow");
}
}
Delete Function
void delete_array()
{
if(count==-1)
{
display();
}
else
{
int i, position, temp;
printf("Enter the position you want to delete: ");
scanf("%d",&position);
if(position-1>count)
{
printf("Deletion not possible.nAs there are no elements in this position.n");
}
else
{
temp=array[position-1];
for(i=position-1;i<=count-1;i++)
{
array[i]=array[i+1];
}
count--;
printf("The elememt deleted is %d.n",temp);
display();
}
}
}
Display Function
void display()
{
int i;
if(count==-1)
{
printf("Array is empty.");
}
else
{
printf("Elements in array: ");
for(i=0;i<=count;i++)
{
printf(" %d ",array[i]);
}
}
printf("n");
}
Presented By:-
Sayantan Sur
Thank You

More Related Content

What's hot

Voice based email for blinds
Voice based email for blindsVoice based email for blinds
Voice based email for blindsArjun AJ
 
Machine learning ppt
Machine learning pptMachine learning ppt
Machine learning pptRajat Sharma
 
Instagram Clone | Instagram Clone App | Instagram Clone Script
Instagram Clone | Instagram Clone App | Instagram Clone ScriptInstagram Clone | Instagram Clone App | Instagram Clone Script
Instagram Clone | Instagram Clone App | Instagram Clone ScriptSwethaMohan21
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionBadrul Alam
 
Football League Management System Final Year Report
Football League Management System Final Year ReportFootball League Management System Final Year Report
Football League Management System Final Year ReportShahzaib Ibrahim
 
My Graduation Project Documentation: Plagiarism Detection System for English ...
My Graduation Project Documentation: Plagiarism Detection System for English ...My Graduation Project Documentation: Plagiarism Detection System for English ...
My Graduation Project Documentation: Plagiarism Detection System for English ...Ahmed Mater
 
presentation on Android Employee tracker (Requirement gathering).
presentation on Android Employee tracker (Requirement gathering). presentation on Android Employee tracker (Requirement gathering).
presentation on Android Employee tracker (Requirement gathering). Zohaib Arshid
 
Expert systems in artificial intelegence
Expert systems in artificial intelegenceExpert systems in artificial intelegence
Expert systems in artificial intelegenceAnna Aquarian
 
Daily Expense Tracker BSc.CSIT Project Nepal
Daily Expense Tracker BSc.CSIT Project NepalDaily Expense Tracker BSc.CSIT Project Nepal
Daily Expense Tracker BSc.CSIT Project NepalRashna Maharjan
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Reportstalin george
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086asrithak
 
context aware computing
context aware computingcontext aware computing
context aware computingswati sonawane
 
Artificial Intelligence in Finance
Artificial Intelligence in FinanceArtificial Intelligence in Finance
Artificial Intelligence in FinanceJakubValnek
 
Result Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsResult Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsJubair Hossain
 
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...Kuntal Bhowmick
 

What's hot (20)

Voice based email for blinds
Voice based email for blindsVoice based email for blinds
Voice based email for blinds
 
Machine learning ppt
Machine learning pptMachine learning ppt
Machine learning ppt
 
Instagram Clone | Instagram Clone App | Instagram Clone Script
Instagram Clone | Instagram Clone App | Instagram Clone ScriptInstagram Clone | Instagram Clone App | Instagram Clone Script
Instagram Clone | Instagram Clone App | Instagram Clone Script
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate Instruction
 
Football League Management System Final Year Report
Football League Management System Final Year ReportFootball League Management System Final Year Report
Football League Management System Final Year Report
 
My Graduation Project Documentation: Plagiarism Detection System for English ...
My Graduation Project Documentation: Plagiarism Detection System for English ...My Graduation Project Documentation: Plagiarism Detection System for English ...
My Graduation Project Documentation: Plagiarism Detection System for English ...
 
presentation on Android Employee tracker (Requirement gathering).
presentation on Android Employee tracker (Requirement gathering). presentation on Android Employee tracker (Requirement gathering).
presentation on Android Employee tracker (Requirement gathering).
 
Expert systems in artificial intelegence
Expert systems in artificial intelegenceExpert systems in artificial intelegence
Expert systems in artificial intelegence
 
Daily Expense Tracker BSc.CSIT Project Nepal
Daily Expense Tracker BSc.CSIT Project NepalDaily Expense Tracker BSc.CSIT Project Nepal
Daily Expense Tracker BSc.CSIT Project Nepal
 
Sentiment analysis
Sentiment analysisSentiment analysis
Sentiment analysis
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Report
 
8086 microprocessor lab manual
8086 microprocessor lab manual8086 microprocessor lab manual
8086 microprocessor lab manual
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086
 
context aware computing
context aware computingcontext aware computing
context aware computing
 
Expense tracker
Expense trackerExpense tracker
Expense tracker
 
Artificial Intelligence in Finance
Artificial Intelligence in FinanceArtificial Intelligence in Finance
Artificial Intelligence in Finance
 
Sih ppt
Sih pptSih ppt
Sih ppt
 
Result Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsResult Management System - CSE Final Year Projects
Result Management System - CSE Final Year Projects
 
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
 
DAA AND DAS
DAA AND DASDAA AND DAS
DAA AND DAS
 

Similar to Array menu (20)

Stack using Array
Stack using ArrayStack using Array
Stack using Array
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Double linked list
Double linked listDouble linked list
Double linked list
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Array list
Array listArray list
Array list
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Array imp of list
Array imp of listArray imp of list
Array imp of list
 
C programs Set 4
C programs Set 4C programs Set 4
C programs Set 4
 
array implementation
 array implementation array implementation
array implementation
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
Qprgs
QprgsQprgs
Qprgs
 
01 list using array
01 list using array01 list using array
01 list using array
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
week-21x
week-21xweek-21x
week-21x
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
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
 

More from Sayantan Sur

Image Encryption and Compression
Image Encryption and Compression Image Encryption and Compression
Image Encryption and Compression Sayantan Sur
 
Decision Support System(DSS)
Decision Support System(DSS)Decision Support System(DSS)
Decision Support System(DSS)Sayantan Sur
 
International Terrorism
International Terrorism International Terrorism
International Terrorism Sayantan Sur
 

More from Sayantan Sur (7)

Image Encryption and Compression
Image Encryption and Compression Image Encryption and Compression
Image Encryption and Compression
 
Decision Support System(DSS)
Decision Support System(DSS)Decision Support System(DSS)
Decision Support System(DSS)
 
Network Security
Network SecurityNetwork Security
Network Security
 
Visual Studio IDE
Visual Studio IDEVisual Studio IDE
Visual Studio IDE
 
Ethical Hacking
Ethical HackingEthical Hacking
Ethical Hacking
 
Phising
PhisingPhising
Phising
 
International Terrorism
International Terrorism International Terrorism
International Terrorism
 

Recently uploaded

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

Array menu

  • 1. Array A Menu Driven Program In C
  • 2. Declarations And Main Function #include<stdio.h> #include<stdlib.h> void insert(), delete_array(), display(); int array[5]; int count=-1; int main() { int choice; while(1) { printf("n---Array Menu---n"); printf("1. Insert.n"); printf("2. Delete.n"); printf("3. Display.n"); printf("4. Exit.n"); printf("Enter your choice: "); scanf("%d",&choice); switch(choice) { case 1: insert(); break; case 2: delete_array(); break; case 3: display(); break; case 4: exit(0); default: printf("Invalid choice."); } } }
  • 3. Insert Function void insert() { int position,data,i; printf("Enter the position you want to insert: "); scanf("%d",&position); printf("Enter an integer value: "); scanf("%d",&data); position-=1; if(count!=4) { if(position<=count+1) { for(i=count+1;i>position;i--) { array[i]=array[i-1]; } count++; array[position]=data; display(); } else { printf("Insertion not possible as there are only %d elements.",count+1); } } else { printf("Array overflow"); } }
  • 4. Delete Function void delete_array() { if(count==-1) { display(); } else { int i, position, temp; printf("Enter the position you want to delete: "); scanf("%d",&position); if(position-1>count) { printf("Deletion not possible.nAs there are no elements in this position.n"); } else { temp=array[position-1]; for(i=position-1;i<=count-1;i++) { array[i]=array[i+1]; } count--; printf("The elememt deleted is %d.n",temp); display(); } } }
  • 5. Display Function void display() { int i; if(count==-1) { printf("Array is empty."); } else { printf("Elements in array: "); for(i=0;i<=count;i++) { printf(" %d ",array[i]); } } printf("n"); }