Question: Write a function called showIndex() that takes as parameters an array, its size and a value of type integer. The function must search for
Write a function called showIndex() that takes as parameters an array, its size and a value of type integer. The function must search for the value in the array and then output the index of each array elements equal to that value. For example, if the first parameter is an array that contains (1,7,5,8,7,3,7,6) the second parameter size is 8, and the third parameter is a value equal to 7. The function must print 1, 3 and 6 since 7 exists at these three array indices. Write a main function that declares an array of 8 integers and asks the user to (1) fill the array elements, and (2) enter any integer k. The program calls the above function to show the indices of the array elements where integer k exists. Sample Run: Enter an integer: 1 Enter an integer: 7 Enter an integer: 5 Enter an integer: 8 Enter an integer: 7 Enter an integer: 3 Enter an integer: 7 Enter an integer: 6 please enter value of k: 7 7 occured at index 1 7 occured at index 4 7 occured at index 6
Step by Step Solution
There are 3 Steps involved in it
Here is a code snippet in C c include void showIndexint ... View full answer
Get step-by-step solutions from verified subject matter experts
