For example: a[6]={1, 2, 3, 4, 5, 6}. I want to insert value 7 into a[2] this array.so the output 1, 2, 7, 3, 4, 5. I write a free function like this
void insert(int a[], int &size, int pos, int number)
{
int i;
for(i=pos;i<size; i++)
{
a[i+1]=a[i];
}
a[pos]=number;
}
Can you correct function for me? I got uncorrectly output.
1,2,7,3,3,3,