T

Team MCQ Buddy • 20.45K Points
Instructor III

Q. What will be the output of the following C program?

Code:
#include <stdio.h>

int main()
{
    int x[5] = { 10, 20, 30 };
    printf("%d", x[3]);
    return 0;
}
  • (A) 0
  • (B) 30
  • (C) Garbage value
  • (D) Error

Explanation by: Team MCQ Buddy
In C language, when an array is partially initialized at the time of declaration then the remaining elements of the array is initialized to 0 by default.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics