Question: Write the following function in a C Program: bool search (const int a[], int n, int key); In the function header, a is an array
Write the following function in a C Program: bool search (const int a[], int n, int key);
In the function header, a is an array to be searched, n is the number of elements in the array, and key is the search key. search should return true if key matches some element of a, and false if doesnt. Use pointer arithmetic not subscripting to visit array elements.
Then write a test program that uses the search function.
Enter 10 numbers: 34 82 49 102 7 94 23 11 50 31
Enter a key: 102
Result: true
Enter 10 numbers: 34 82 49 102 7 94 23 11 50 31
Enter a key: 200
Result: false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
