Question: Programming in C 3. Define an array f= [11, -23, 34, -8, -10, 18, 29], using call by-reference (that is, use of pointers), to pass
Programming in C
3. Define an array f= [11, -23, 34, -8, -10, 18, 29], using call by-reference (that is, use of pointers), to pass the array to a function named: Summation .
In main: define array, pass array, print out the array and the result returned from Summation on screen.
In function : Summation ...
1) take array and size from main
2) sum each element according to the following rules
3) sum each element according to the following rules:
- if the value of f(i) is POSITIVE , add 3*f(i) to the sum
- if the value of f(i) is NEGATIVE, add -2*f(i) to the sum
4) return the final value of sum to main
Note: You MUST use call-by-reference to call functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
