Declarations and Initializations

Q1:
What is the output of the program
#include<stdio.h>
int main()
{
    struct emp
    {
        char name[20];
        int age;
        float sal;
    };
    struct emp e = {'Tiger'};
    printf('%d, %f\n', e.age, e.sal);
    return 0;
}

A 0, 0.000000

B Garbage values

C Error

D None of above

ANS:A - 0, 0.000000

When an automatic structure is partially initialized remaining elements are initialized to 0(zero).



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.