Home / C Programming / Arrays :: Discussion

Discussion :: Arrays

  1. What will be printed after execution of the following code?

    void main()

    {

    int arr[10] = {1,2,3,4,5};

    printf("%d", arr[5]);

    }

  2. A.

     Garbage Value

    B.

     5

    C.

     6

    D.

     0

    E.

     None of these

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    When an array is partially initialized at the time of declaration then the remaining elements of the array is initialized to 0 by default.


Be The First To Comment