Question: 8.12 LAB**: Program: Pointers In this programming assignment, you will write a C program that works with pointers and dynamically allocated arrays. You will ask

8.12 LAB**: Program: Pointers

In this programming assignment, you will write a C program that works with pointers and dynamically allocated arrays. You will ask the user for a size and then dynamically allocate the array of integers of that size, and use the pointer to the array for further calculations.

Write the main() that will do the following:

Take the size for the dynamically allocated array from the user.

Create myData as an integer pointer type variable. Dynamically allocate memory for an integer array using the input size.

Using the myData pointer and a loop, initialize the array member values to the index number that object exists in the array.

Loop through the filled array using the myData pointer and print out the array contents separated by space.

Also calculate the average of the array's data members and print it. The value should be shown with exactly 2 decimal places. The output must look exactly like this in terms of formatting. Below is an example for when the user enters 5.

Free the array when you are done.

0 1 2 3 4 average: 2.00 

Save your main.c file and upload it below for grading.

8.12 LAB**: Program: Pointers In this programming assignment, you will write a

In this programming assignment, you will write a C program that works with pointers and dynamically allocated arrays. You will ask the user for a size and then dynamically allocate the array of integers of that size, and use the pointer to the array for further calculations. - Write the main ( ) that will do the following: - Take the size for the dynamically allocated array from the user. - Create mydata as an integer pointer type variable. Dynamically allocate memory for an integer array using the input size. - Using the mydata pointer and a loop, initialize the array member values to the index number that object exists in the array. - Loop through the filled array using the myData pointer and print out the array contents separated by space. - Also calculate the average of the array's data members and print it. The value should be shown with exactly 2 decimal places. The output must look exactly like this in terms of formatting. Below is an example for when the user enters 5. - Free the array when you are done. 01234 average: 2.00 Save your main.c file and upload it below for grading

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!