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++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 6PP: (Numerical) a. Define an array with a maximum of 20 integer values, and fill the array with numbers...
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
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
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,