Question: This is C programming Function 1 Write a function that returns void and takes an int * (pointer to integer array) or int[], and int

This is C programming

Function 1 Write a function that returns void and takes an int * (pointer to integer array) or int[], and int (for the size). The function needs to initialize all the elements of the array to non-zero values.

Function 2 Write another function that returns int and takes an const int * (pointer to integer array) or int[], and int (for the size). The function should sum all the elements of the array and return the sum.

In main define an integer array of size 5. Call function 1 in main to initialize the values of the array. Call function 2 in main to get the sum and print the value of the sum to the console.

I've only come to writing function2:

int function2 (int arr[], int size) {int sum = 0; for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!