What are the benefits of arrays ? | SoloLearn: Learn to code for FREE!


What are the benefits of arrays ?


11/19/2019 2:52:39 PM

The unknown 321

4 Answers

New Answer


You cannot store more than 1 value in a variable. If you want to store many values of same type you can either declare N variable to store N values or create an array of size N to store N values. An array name is considered as one variable only. To access the elements in the array you need to use indexing. Same is the case if you want to pass many variables of same type to a function, either specify N parameters or pass the values through array using a pointer.


Yes usually in a single row with N columns but depending on your requirement you can arrange them in rows and columns or higher dimension arrays. And all elements you put in the array must be of the same type or convertible to the type of the array declared.


The unknown 321 Essentially... yes. Another way to think of arrays is as a container that holds a series of values stored in a sequential set of memory addresses. The first memory address is assigned to the array variable. From there, the next value is stored in the adjacent memory address, followed by the next value, and so on and so forth.


You mean that instead of creating many individual variables of the same type. You put all these variables in one type of data in a row ?