Home / C Programming / Declarations and Initializations :: Discussion

Discussion :: Declarations and Initializations

  1. What is the output of the program

    #include 
    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; 
    } 
    

  2. A.

    0, 0.000000

    B.

    Garbage values

    C.

    Error

    D.

    None of above

    View Answer

    Workspace

    Answer : Option A

    Explanation :

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


Be The First To Comment