Learn to declare, initialize, and access elements in a simple linear array.
A one-dimensional array is the simplest form of an array in C. It is a structured collection of elements, all of which have the same data type, stored in a contiguous block of memory. Think of it as a list or a sequence of variables that can be accessed collectively under a single name. To declare a 1D array, you specify the data type of its elements, the name of the array, and its size in square brackets. For example, `int scores[5];` declares an array named `scores` that can hold 5 integer elements. The size must be a constant integer expression. Once declared, this array has 5 memory locations reserved for integers. The elements of an array are accessed using an index, which is an integer value that specifies the position of the element within the array. A critical rule in C is that array indexing is zero-based, meaning the first element is at index 0, the second at index 1, and so on. For the `scores` array of size 5, the valid indices are 0, 1, 2, 3, and 4. You can access an element by writing the array name followed by the index in square brackets, such as `scores[0]`. You can both read from and write to array elements this way. Arrays can be initialized at the time of declaration by providing a list of values in curly braces, like `int numbers[3] = {10, 20, 30};`. Iterating through all elements of an array is a very common operation, and this is typically done using a `for` loop.