Question: How could I cretate this C Program using the malloc function and pointer notation void initialize_array(int *, int ): This function takes an integer pointer

How could I cretate this C Program using the malloc function and pointer notation

void initialize_array(int *, int ):

This function takes an integer pointer and the input size( treat it as

10) and stores random numbers using the integer pointer. The random numbers range from the

value 1 to

9 only

.

void print_array(int *, int):

This function takes an integer pointer and the input size and prints out

random numbers using the integer pointer.

float mean (int *, int):

This function takes an integer pointer (to an integer array) and the input size and

returns the average of all the numbers in the array.

main():

Instead of reading the input size from the user, preset the size variable to 10 and then move

forward. Call functions initialize_array and print_array to store and print the random numbers. Display

the results as shown in the sample output below.

Note:

Use only pointer notation and pointer arithmetic to implement the assignment.

Sample output:

Enter the size of the array:

109

Please enter again:

-1

Please enter again:

7

The array is:

9 1 5 1 9 4 5

The mean of all the numbers = 4.86

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!