What will be the output of the following C code? int arr[] = {10, 20, 30, 40};…

2025

What will be the output of the following C code?

int arr[] = {10, 20, 30, 40};
for(int i = 0; i < 4; i++) {
printf("%d ", arr[i]);
}

Answer: B. 10 20 30 40

  1. A.

    0 1 2 3

  2. B.

    10 20 30 40

  3. C.

    Compilation error

  4. D.

    arr[0] arr[1] arr[2] arr[3]

Attempted by 277 students.

Show answer & explanation

Correct answer: B

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…