Structures, Unions, Enums

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

int main()
{
    struct a
    {
        float category:5;
        char scheme:4;
    };
    printf("size=%d", sizeof(struct a));
    return 0;
}

A Error: invalid structure member in printf

B Error in this float category:5; statement

C No error

D None of above

ANS:B - Error in this float category:5; statement

Bit field type must be signed int or unsigned int. The char type: char scheme:4; is also a valid statement.



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.