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

Discussion :: Structures, Unions, Enums

  1. Point out the error in the program?

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

  2. A.

    Error: invalid structure member

    B.

    Error: Floating point formats not linked

    C.

    No error

    D.

    None of above

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    At run time it will show an error then program will be terminated.

    Sample output: Turbo C (Windows)

     

    c:\>myprogram                                                            Sample 12.123  scanf : floating point formats not linked  Abnormal program termination  

     


Be The First To Comment