Home / C Programming / Structures, Unions, Enums :: Discussion

Discussion :: Structures, Unions, Enums

  1. Which of the following statements correct about the below program?

    #include 
     int main() 
     {   
         struct emp  
         {       
            char name[25];     
            int age;       
            float sal;     
        };    
        struct emp e[2];     
        int i=0; 
        for(i=0; i2; i++)          
            scanf("%s %d %f", e[i].name, 
             
    &e[i].age, &e[i].sal); 
       for(i=0; i2; i++)           
            scanf("%s %d %f", e[i].name,  
            e[i].age, e[i].sal);
        return 0;
     } 
    

     

  2. A.

    Error: scanf() function cannot be used for structures elements.

    B.

    The code runs successfully.

    C.

    Error: Floating point formats not linked Abnormal program termination.

    D.

    Error: structure variable must be initialized.

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment