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 / dhaivat

void arrayins(int arr[], int& n, int pos, int item)
{
if (n==MAX) //Size of array is MAX
cout<<"Overflow\n";
else
{
for (int x=n; x>=pos; x--)
arr[x+1]=arr[x];
arr[pos]=item;
n++;
cout<<item<<" inserted in the array\n";
}

Is This Answer Correct ?    17 Yes 47 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c the same as c++?

1007


Is std :: string immutable?

1031


Why is null pointer used?

1168


Explain the difference between realloc() and free() in c++?

1012


What is an inclusion guard?

1191


How long does it take to get good at leetcode?

1166


what is c++

2381


What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random

1125


Explain shallow copy?

1036


Explain "const" reference arguments in function?

1049


Can a built-in function be recursive?

1019


What is c++ map?

1153


Write a program to add three numbers in C++ utilizing classes.

1107


What does int * mean in c++?

1229


Is python better than c++?

1021