Introductions to Arrays C++ language

An array in C is a collection of elements of the same data type that are arranged in contiguous memory locations. Each array element is identified by its index or position within the array, with the first element typically having an index of 0. Multiple values of the same data type can be stored and managed conveniently using arrays. A C array's elements are declared, initialized, and accessed as follows:

Declaration and Initialization of Arrays:

The data type of an array's elements, the array name, and the array size are all declared in square brackets in the C programming language. Here's an example of declaring a 5-dimensional integer array:

int myArray[5];         // declaration of a 5-dimensional integer array

You can also initialize an array when declaring it:

int myArray[5] = {10, 20, 30, 40, 50}; // Initialization and declaration of an integer array

In this example, myArray is initialized with specific values and declared as an integer array of size 5.

Accessing Elements of an Array:

You must use the array name and the desired element's index (position) in order to access an element in an array. Keep in mind that array indices begin at 0. 

Example:

int value = myArray[5]; // Use index 5 to access the array's third element.

Array Size:

In C, the 'sizeof' operator can be used to find an array's size. 

int size = sizeof(myArray) / sizeof(myArray[1]); //Calculate the array's size.