a.       Write a C function called find, which receives the following 3 parameters: an integer array, the array size, and a number to search for. This function searches for the number (passed via the third parameter), within the array (passed via the first parameter). If the number is found in the array, the index of the array element where the number was found is returned by the function. If the number is not found, the program returns the value -1.   b. Explain which parameter passing approach you are using for the three parameters and why you are using that approach for each of the parameters.    c.   Write a C main program that creates an array, puts data into the array, and then calls your find function to search for a particular number. You decide on the contents and size of the array, and the number to search for. If the number is found in the array, your main program prints “found” to the screen. If it is not found, it prints “not found” to the screen.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
icon
Related questions
Question

This question has three parts 

a.       Write a C function called find, which receives the following 3 parameters: an integer array, the array size, and a number to search for. This function searches for the number (passed via the third parameter), within the array (passed via the first parameter). If the number is found in the array, the index of the array element where the number was found is returned by the function. If the number is not found, the program returns the value -1.

 

b. Explain which parameter passing approach you are using for the three parameters and why you are using that approach for each of the parameters. 

 

c.   Write a C main program that creates an array, puts data into the array, and then calls your find function to search for a particular number. You decide on the contents and size of the array, and the number to search for. If the number is found in the array, your main program prints “found” to the screen. If it is not found, it prints “not found” to the screen.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr