Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to insert an element into an array

Answer Posted / sonia

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int a[10]={10,20,30,40,50,60,70,80,90};
int num,i,pos;
printf("enter the no which you want to insert");
scanf("%d",&num);
printf("enter the position");
scanf("%d",&pos);
if(pos<0 || pos>9)
{
printf("invalid position");
getch();
exit(0);
}
for(i=9;i>pos;i--)
a[i]=a[i-1];
a[pos]=num;
for(i=0;i<=9;i++)
printf(" %d",a[i]);
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a constructor be private?

1068


What is data types c++?

1014


What's the order in which the local objects are destructed?

1260


What language is a dll written in?

1020


Why do we use using namespace std in c++?

1074


What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack

1080


What is the difference between the parameter to a template and the parameter to a function?

1116


What is vector processing?

1139


Eplain extern keyword?

1026


How do you declare A pointer to a function which receives nothing and returns nothing

1231


What is an overflow error?

1095


Can there be at least some solution to determine the number of arguments passed to a variable argument list function?

996


What return value must conversion operators have in their declaration?

1083


Why is c++ still used?

1083


How would you use qsort() function to sort an array of structures?

1117