Arrays: initializer lists

supriyo_biswas · updated April 11, 2020
#include <stdio.h>

int main() {
    // declare and initialize an array with an
    // initializer list
    int a[4] = {10, 20, 30, 40};

    // print the elements
    printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]);

    return 0;
}
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.