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
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