type array_name[array_size];
int
, float
, char
).int numbers[5];
numbers
that can hold 5 integers.Arrays can be initialized at the time of declaration or afterward. Initialization can be done with a specific set of values.
type array_name[array_size] = {value1, value2, ..., valueN};
int numbers[5] = {1, 2, 3, 4, 5};
numbers
with the values 1, 2, 3, 4, and 5.If fewer values than the array size are provided, the remaining elements are initialized to zero (for basic types).
int numbers[5] = {1, 2};
The array size can be omitted if the initialization list is provided.
int numbers[] = {1, 2, 3, 4, 5};