Arrays: initializer lists

supriyo_biswas · updated November 17, 2019 · C
#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;
}

Comments

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