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
- A.
0 1 2 3
- B.
10 20 30 40
- C.
Compilation error
- D.
arr[0] arr[1] arr[2] arr[3]
Attempted by 277 students.
Show answer & explanation
Correct answer: B
Loading lesson…