Question: Exercise 5 : Search in an array with pointers ( a ) Wrire the following function: int search ( int a [ ] , int
Exercise : Search in an array with pointers
a Wrire the following function:
int searchint int int key
is an array to be searched, is the number of elements in the array, and key is the key being searched. search
should return TRUE if key matches some element of FALSE if it doesn't. Use pointer arithmetic not
subscripting to visit array elements
b Assume that the following array contains a week's worth of hourly temperature readings, with each row containing
the readings for one day:
int temperatures;
Write a function that uses the search function, defined in a to search the entire temperatures array for a value,
val, and returns the row in which it is found.
c Write a function that uses a loop to print all temperature readings stored in row of the temperatures array. Use a
pointer to visit each element of the row.
d Write a driver program to test all your functions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
