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[-1]);
    return 0;
}
  • (A) 0
  • (B) 10
  • (C) Garbage value
  • (D) Error

Explanation by: Team MCQ Buddy
C language compiler does not check array with its bounds, when an index is out of the range the garbage value is printed.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics