Learn to declare, initialize, and access elements in 1D and 2D arrays.
An array is a data structure that stores a fixed-size, sequential collection of elements of the same type. Think of it as a row of numbered boxes, where each box holds a value of the same kind. You declare an array by specifying the type of its elements, its name, and its size in square brackets. For example, `int scores[5];` declares an array named `scores` that can hold 5 integers. The elements of an array are accessed using a zero-based index. This means the first element is at index 0, the second at index 1, and so on, up to `size - 1`. So, for our `scores` array, the valid indices are 0, 1, 2, 3, and 4. You can access an element with `scores[0]`, `scores[1]`, etc. You can initialize an array at the time of declaration using an initializer list, like `int numbers[3] = {10, 20, 30};`. C++ also supports multi-dimensional arrays. A two-dimensional array, for instance, can be thought of as a grid or a table. You declare it with two size specifiers: `int matrix[3][4];` creates a 2D array with 3 rows and 4 columns. You access its elements with two indices, `matrix[row][col]`. A key characteristic of C-style arrays is that they don't have built-in bounds checking, so accessing an element outside the array's defined range (e.g., `scores[5]`) leads to undefined behavior, a common source of bugs.