Insertion mean add new element in Existing data structure such as insertion in array, insertion in link list etc.
Array has static size but sometime we insert less data then its actual size so at run time we can add further elements,
As shown in below program
/*
This is a program for Insertion
Date : 20 April 2014
Time : 11:10 PM
*/
#include<stdio.h>
#include<conio.h>
#define max_size 10
int main()
{
int arr[max_size],no,tmp_no,i;
char ch;
start:
printf("\nEnter How many Number do you want to insert out of %d : ",max_size);
scanf("%d",&no);
if(no>max_size){
printf("\nSorry you have only %d Maximum size ",max_size);
printf("\nPlease Try Again : ");
goto start;
}
for(i=0;i<no;i++)
{
printf("Enter Number %d : ",i+1);
scanf("%d",&arr[i]);
}
do{
printf("\nYour Array is : ");
for(i=0;i<no;i++)
{
printf("\n Number %d : %d",i+1,arr[i]);
}
if(no==max_size-1){
printf("\nArray Overflow ");
break;
}
printf("\nEnter a Number to insert : ");
scanf("%d",&tmp_no);
arr[no]=tmp_no;
no++;
printf("\nDo you want to insert more (y/n) : ");
ch=getche();
}while(ch=='y' || ch =='Y');
printf("\nThanks For visiting for more please Visit http://latestfaq.blogspot.in/");
getch();
return 0;
}
Download Source File : Insertion.c
other impotent links : deletion in array, Insertion and deletion in array.binary search.
keywords : insertion in array in c, insertion program in c, insertion and deletion.
Array has static size but sometime we insert less data then its actual size so at run time we can add further elements,
As shown in below program
/*
This is a program for Insertion
Date : 20 April 2014
Time : 11:10 PM
*/
#include<stdio.h>
#include<conio.h>
#define max_size 10
int main()
{
int arr[max_size],no,tmp_no,i;
char ch;
start:
printf("\nEnter How many Number do you want to insert out of %d : ",max_size);
scanf("%d",&no);
if(no>max_size){
printf("\nSorry you have only %d Maximum size ",max_size);
printf("\nPlease Try Again : ");
goto start;
}
for(i=0;i<no;i++)
{
printf("Enter Number %d : ",i+1);
scanf("%d",&arr[i]);
}
do{
printf("\nYour Array is : ");
for(i=0;i<no;i++)
{
printf("\n Number %d : %d",i+1,arr[i]);
}
if(no==max_size-1){
printf("\nArray Overflow ");
break;
}
printf("\nEnter a Number to insert : ");
scanf("%d",&tmp_no);
arr[no]=tmp_no;
no++;
printf("\nDo you want to insert more (y/n) : ");
ch=getche();
}while(ch=='y' || ch =='Y');
printf("\nThanks For visiting for more please Visit http://latestfaq.blogspot.in/");
getch();
return 0;
}
Download Source File : Insertion.c
other impotent links : deletion in array, Insertion and deletion in array.binary search.
keywords : insertion in array in c, insertion program in c, insertion and deletion.
Insertion Program in C
Reviewed by Unknown
on
22:36
Rating:
No comments: