217k views
2 votes
Suppose you want to write a program that will read a list of numbers from a user, place them into an array and then compute their average. How large should you make the array?

1 Answer

3 votes

Answer:

The size of the array is dependent on the amount of memory the program can access.

Step-by-step explanation:

Here according to the question the user is in need of memory space equal to the amount of numbers read from the list. So the size of the array should be equal to the total numbers read from the list. if the user reads 5 number from the list then the size of the array should be int a[5] if the numbers are integers. Wastage of memory space is not appreciated in a good piece of code.

User Efkah
by
4.9k points