C program to insert an element in an array, for example, consider an array a[10] having three elements in it initially and a[0] = 1, a[1] = 2 and a[2] = 3 and you want to insert a number 45 at location 1 i.e. a[0] = 45, so we have to move elements one step below so after insertion a[1] = 1 which was a[0] initially, and a[2] = 2 and a[3] = 3. Array insertion does not mean increasing its size, i.e., array will not contain 11 elements.
output:
Enter number of elements in array
3
Enter 3 elements
1
23
4
Enter the location where you wish to insert an element
2
Enter the value to insert
22
Resultant array is
1
22
23
4
need an explanation for this answer? contact us directly to get an explanation for this answer