explain in details what are arrays and why do we need to use arrays
Answers
Answered by
0
Answer:
Arrays is a data structure, something that we provides structure to the data, that is a way to arrange our data.
the data is arranged in a continuous block of memory. And we can access data in O(1) time by specifying the index of the location.
the index in most of the programming languages starts from 0 to the size-1.
why do we need to use?
consider you have ages of 3 people, you need to create 3 variables for it.lets say age1,age2,age3.and all three will be randomly allocated in the memory.
using the array we create age[3] and it will allocate the memory for 3 continuous variables
age[0],age[1],age[2].
Similar questions