What will be the output of the following program? (MCQ) #include <stdio.h> int…

What will be the output of the following program? (MCQ)

#include <stdio.h>

int main() {

register int i;

int arr[2];

arr[0] = 10;

arr[1] = 20;

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

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

}

return 0;

}

  1. A.

    Array index out of bound error

  2. B.

    none of these

  3. C.

    arr[0] = 10

    arr[1] = 20

  4. D.

    Syntax error

Attempted by 563 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…