Today we will talk about arrays.
What is Array?
An array is a collection of elements of similar data types.
Array Can be dynamic or static
Static Array - Size cannot be changed.
Dynamic Array - Size Can be changed by memory reallocation.
Memory Representation of array:
Properties of array:
- Elements in an array are stored in contiguous memory locations.
- Elements in an array can be accessed using the base address in constant time O(1).
- Changing the size of an array is not possible but we can reallocate it to some bigger memory location.