what is the use of bitfields & where do we use them?
Answers were Sorted based on User's Feedback
Answer / naveen shukla
Bit field is an idiom used in the computer programming
language to store a value as a short series of bits .
It is most commanly used when we know the fix width of int
type variable to be used .
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / rams
Bit fields are used to restrict the size of a structure member. we can reduce the size of a structure member as a result no wastage of bits. suppose if i want to store date generally it is between 1 to 31 we can store it in 5 bits only.
bit fields can be used only with in structure.
ex:struct st
{
char date:5;
};
| Is This Answer Correct ? | 0 Yes | 0 No |
what is the difference between getch() and getche()?
Explain what is wrong with this statement? Myname = ?robin?;
What is Function Pointer? Explain with example?
what is the coding of display the factorial of a number using array and function?
In c language can we compile a program without main() function?
What type is sizeof?
wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }
How will you write a code for accessing the length of an array without assigning it to another variable?
What is a static variable in c?
m=++i&&++j(||)k++ printf("%d"i,j,k,m)
how to construct a simulator keeping the logical boolean gates in c
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none