C passing parameter by reference
Need a C program that has a declaration in main () to store the following numbers into an array named rates:2.3,3.3,4.4,5.5,6.0. There should be a function call to show () that accepts rates in a parameter named rates and then displays the numbers using the pointer notation *(rates + i).
© BrainMass Inc. brainmass.com May 24, 2023, 12:59 pm ad1c9bdddfhttps://brainmass.com/computer-science/c/c-passing-parameter-reference-7981
Solution Preview
If I understand correctly, you are asking how a program can be created that
1. Declares and stores four(4) real numbers.
2. Calls another function called show() which
2a. Accepts the parameter named rates and
2b. Displays the parameter ( the array in main() ) by some print function and using pointer notation *(rates+i)
You require an understanding of pointers and how to pass and receive parameter by reference in order to solve this fairly straightforward problem.
Please understand that under Brainmass guidelines I am prevented from giving you a straightforward result or solution. However I can provide you with snippets of code examples that will show you how to deal with pointers in a function. I will also like to keep the given ...
Solution Summary
How a program can be created so that
1. Declares and stores four(4) real numbers.
2. Calls another function called show() which
2a. Accepts the parameter named rates and
2b. Displays the parameter ( the array in main() ) by some print function and using pointer notation *(rates+i)
You require an understanding of pointers and how to pass and receive parameter by reference in order to solve this fairly straightforward problem.