Declarations and Initializations

Q1:
What is the output of the program
#include<stdio.h>
int main()
{
    int a[5] = {2, 3};
    printf('%d, %d, %d\n', a[2], a[3], a[4]);
    return 0;
}

A Garbage Values

B 2, 3, 3

C 3, 2, 2

D 0, 0, 0

ANS:A - Garbage Values

When an automatic array is partially initialized, the remaining elements are initialized to 0.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.