Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions