what is array?

+1 vote
asked Feb 7 by labintumbapo (160 points)

1 Answer

0 votes
answered Feb 12 by gameforcer (2,950 points)

From a technical point of view:

It is a block of memory that allocates N elements of the same byte size.

Less technical:

It is a set of elements that you can access by single name and some iteration, C++ example:

int arr[3] = {1,2,3};

std::cout<<arr[0];

Here array's name is "arr" and each element is accessed by adding square brackets to it's name with element's position number (index) inside them.

In most languages array indexes start from zero, therefore in this example it will print out first element of array, which has value of 1.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...