Question: Write a C++ function int find(int x[ ], int N, int target); that accepts an integer array x of size N, and returns the
Write a C++ function int find(int x[ ], int N, int target); that accepts an integer array x of size N, and returns the index of element target if it exists in the array. If it doesn't exist, the function should return -1. Test the above function by writing an appropriate main() program. All printouts should be done in main Sample run 1: Enter 5 elements: 2 4 6 8 10 Enter an element to search for: 6 The element is at index 2 Sample run 2: Enter 5 elements: 2 4 6 8 10 Enter an element to search for: 3 The element is not in the array
Step by Step Solution
There are 3 Steps involved in it
Heres the C function find that searches for an element in an integer array and returns its index if ... View full answer
Get step-by-step solutions from verified subject matter experts
