Array: Demo

Variables and data types
  • Ses5Array Source Code

    #include <stdio.h>

    #include <stdlib.h>

     

    int main(int argc, char *argv[]) {

        int a[3];

        a[0] = 5;

        a[1] = 6;

        a[2] = 1;

     

        printf("First element: %d\n", a[0]);

        printf("Second element: %d\n", a[1]);

        printf("Third element: %d\n", a[2]);

     

        int b[] = {4, 5, 6};

        int size = sizeof (b) / sizeof (int);

        printf("Size of arrray a is: %d\n", size);

     

        int i;

        for (i = 0; i < size; i++) {

            printf("b[%d] = %d\n", i, b[i]);

        }

        return 0;

    }