Question: /* Write a function named addarray() that returns the sum of the elements of an array of int values. Your functions should take two parameters,
/* Write a function named addarray() that returns the sum of the elements of an array of int values. Your functions should take two parameters, the array and the number of elements in the array. Make your function work with the following program; */ /* arraysum.c * * Synopsis - displays the value returned by the function addarray() * with 2 different sets of parameters. * * Objective - To provide a test program for the addarray() function. * Your answers should be 55 and 0. * */ #includeint addarray(int [], int, int); void main() { int array1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int array2[4] = {0, 0, 0, 0}; printf("The sum of array1 = %d ", addarray(array1, 0, 10)); printf("The sum of array2 = %d ", addarray(array2, 0, 4)); }
I am trying to figure out this problem. Can you guys give me an example for this coding question.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
