C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Point Out Errors (Q.No. 3)
3.
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;
}
Answer: Option
Explanation:
Bit field type must be signed int or unsigned int.
The char type: char scheme:4; is also a valid statement.
Discussion:
25 comments Page 3 of 3.
K.maheswari said:
1 decade ago
Any one explain this concept ?
Santosh said:
1 decade ago
Please someone explain this.
Jyoti said:
1 decade ago
Why char scheme:4; is valid ?
Since it is char of 1 byte field.
Since it is char of 1 byte field.
Jayaram said:
1 decade ago
Explain the concept and how it can be useful in progrm and how the value will get signed or unsigned.
Ashwani said:
1 decade ago
Can anyone explain this please ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers