July 2025
Beginner
528 pages
13h 18m
English
An array is a block of memory containing elements of the same type. We access each element in the array using its index. An array is defined specifying the number of elements in the array.
int a[100];
Here, a is an array of 100 integers. We can access its elements using its index, for example, a[17]. Please note that the index starts from 0, so a[17] is actually the 18th element in the array.
The base address of the array is the same as the address of the first element, referred using the name of the array itself. In the above example, we say the base address of the array is a, which is the address of its first element, a[0].
The address of the ith element in the array can be computed as base address + i times the size ...
Read now
Unlock full access