arrays

C Arrays

C Arrays

An array is a collection of variables that are of the same type, and they can be accessed using an index.

Declaring an Array

#include 

int main() {
    int numbers[5] = {1, 2, 3, 4, 5};
    printf("First element: %d\n", numbers[0]);
    return 0;
}
    

This program declares an array numbers with 5 integer elements and prints the first element.