Question: Write a function named insertinArray that takes the following parameters: list: an integer array index: index at which to insert the new item numitems: number

 Write a function named insertinArray that takes the following parameters: list:

Write a function named insertinArray that takes the following parameters: list: an integer array index: index at which to insert the new item numitems: number of items currently in the array arrayCapacity: capacity of the array newVal: value to insert into the array If the array is at capacity then the function should return-1. Otherwise, insert newVal at index and return 0 for success. int insertInArray(int list[ ], int index, int* numItems, int arrayCapacity, int newVal) For example, if the array is 19, 2, 8, 3) and it has the capacity to add a new value of 5 at index 2, then the resulting array should be (9, 2,5,8, 3 and the function should return 0. The numltems variable will increment from 4 to 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!