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

How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

1103


C is to C++ as 1 is to a) What the heck b) 2 c) 10

1022


What operator is used to access a struct through a pointer a) >> b) -> c) *

1070


What happens when you make call 'delete this;'?

1042


How would you find out if a linked-list is a cycle or not?

978


What is an operator function? Describe the function of an operator function?

1094


What are c++ storage classes?

1067


Am pass the 10000 records to target in target I will take commit interval 15000 when I was stop the work flow what will happened

1522


How to declaring variables in c++?

1123


What is the advantage of an external iterator.

996


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

998


When is the copy constructor called?

1101


Does there exist any other function which can be used to convert an integer or a float to a string?

1046


Do you know what are pure virtual functions?

1115


What is the difference between reference and pointer?

1111