Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
An array is a collection of elements of the SAME type stored in contiguous memory locations. It's the most basic data structure for storing lists of items.
int arr[5] = {1, 2, 3, 4, 5};
cout << arr[0]; // 1 (First element)
cout << arr[4]; // 5 (Last element)The size must be known at compile time and cannot be changed later.
Indices range from 0 to (size - 1).
C++ doesn't check array boundaries at runtime. Accessing arr[size] leads to undefined behavior or crashes.