Structures, Unions, Enums

Q1: Point out the error in the program?
#include<stdio.h>

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

A Error: invalid structure member

B Error: Floating point formats not linked

C No error

D None of above

ANS:A - Error: invalid structure member

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 



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.