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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started