Sunteți pe pagina 1din 5

>Program to insert and delete element in array.

progsolution

http://progsolution.wordpress.com/2011/05/11/program-to-insert-and-d...

progsolution
This site is for all the students of engg and who are interested in programing. Home Adv Java c program Computer Graphics Data Structure Java VB.Net

Home > Data Structure > >Program to insert and delete element in array.

>Program to insert and delete element in array.


May 11, 2011 vaibhavwp Leave a comment Go to comments >/**************************** WAP TO IMPLEMENT MENU DRIVEN PROGRAM TO INSERT AND DELETE ARRAY ELEMENTS. *****************************/ #include stdio.h #include conio.h int a[100]; int n; void insert(int,int); void del(int); void display(); void main() { int i,ch,x,pos; clrscr(); printf(Enter Size of Array: ); scanf(%d,&n); printf(Enter %d Elements: ,n); for(i=0;in) { printf(\nPosition Not Valid!!\n); } else { insert(x,pos-1);

1 of 5

12/24/2012 5:27 PM

>Program to insert and delete element in array. progsolution

http://progsolution.wordpress.com/2011/05/11/program-to-insert-and-d...

} break; } case 2: { printf(\nEnter The Element: ); scanf(%d,&x); del(x); break; } case 3: { display(); break; } case 4: { exit(); } default: { printf(\nInvalid Choice!!); } } } } void insert(int x,int p) { int i; for(i=n;i>=p;i) { a[i+1]=a[i]; } a[p]=x; n=n+1; printf(\nArray Elements Updated.\n); } void del(int x) { int i,f; for(i=0;i { if(a[i]==x) { for(;i { a[i]=a[i+1]; } a[n-1]=0;

2 of 5

12/24/2012 5:27 PM

>Program to insert and delete element in array. progsolution

http://progsolution.wordpress.com/2011/05/11/program-to-insert-and-d...

n=n-1; f=1; break; } } if(f==1) { printf(\nElement Deleted.\n); } else { printf(\nElement Not Found.\n); } } void display() { int i; if(n==0) { printf(\nArray List is Empty.\n); return; } printf(\nThe Elements Are:\n); for(i=0;i { printf(%d\t,a[i]); } printf(\n); }
About these ads

Please fill in your details, we will contact you shortly.


* All fields are mandatory

First Name

Last Name

Mobile Number Email ID

City of Residence Annual Income

Salaried Company Name

Be the first to like this.

Categories: Data Structure Tags: array, data structure, delete, insert Comments (0) Trackbacks (0) Leave a comment Trackback 1. No comments yet.

3 of 5

12/24/2012 5:27 PM

>Program to insert and delete element in array. progsolution

http://progsolution.wordpress.com/2011/05/11/program-to-insert-and-d...

1. No trackbacks yet.

Leave a Reply

>Program for Translation. >Program for Doubly linked list. RSS feed

Twitter

Search

Archives

Tags

A.java array authenticate BufferedReader c click computer graphics console application cookies database data structure delete factorial
area of circle browser button chat prog datarow FlowLayput greatest no GridLayout prime no

InputStreamReader insert insert delete

java MS-access navigation overriding pointer

reverse no runtime simple Sqlserver database stack string handling Table components translation UDP

vb.net

vector window

application writexml() XML XML schema

Useful Links visitors

RSS FEED
Top WordPress

4 of 5

12/24/2012 5:27 PM

>Program to insert and delete element in array. progsolution

http://progsolution.wordpress.com/2011/05/11/program-to-insert-and-d...

Blog at WordPress.com. Theme: INove by NeoEase.

5 of 5

12/24/2012 5:27 PM

S-ar putea să vă placă și