Question: Using pointers and dynamic memory allocation, write a C++ program which will call function SearchN to search a one-dimensional array x of size n for

Using pointers and dynamic memory allocation, write a C++ program which will call function "SearchN" to search a one-dimensional array x of size n for a specific value. The function should return how many times the key value is present in the array and the location of the first occurrence of the key value in the array. Write your main() program to test your function. Display all output in your main program. Nothing should be displayed in the function. The following is a sample of a running program.

Enter the size of the array: 10

Enter the values for array x: 2 4 5 3 8 4 -5 4 12 1

Enter the key: 4

The value 4 is present 3 times

The first key at subscript 1

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!