+1 vote
in Computer by kratos

What is an array? What is the need for array?

1 Answer

+4 votes
by kratos
 
Best answer

Array: An array is a collection of variables of the same type that are referenced by a common name.

Need for array: Arrays are very much useful in a case where many variables of the same (data) types need to be stored and processed. For example, suppose we have to write a program in which can accept salary of 50 employees. If we solve this problem by making use of variables, we need 50 variables to store employee’ salary. Remembering and managing these 50 variables is not an easy task and it will make the program a complex and lengthy program. This problem can be solved by declaring 1 array having 50 elements; one for employee’ salary. Now we only have to remember the name of that 1 array.

...