What are bit fields? What is their use?
Answers were Sorted based on User's Feedback
Answer / ravi joshi
Bit fields can only be declared inside a structure or a
union, and allow you to specify some very small objects of a
given number of bits in length. Their usefulness is limited
and they aren't seen in many programs, but we'll deal with
them anyway.
| Is This Answer Correct ? | 6 Yes | 0 No |
Bit fields main intention is to reduce the memory
consumption.
Syntax:
------
struct
{
int a:1;
/*whatever may be the size of the int(compiler dependent),
only one bit shall be allocated for variable 'a'*/
}BITFIELDS;
Restictions:
------------
1. Accessing or printing address of bitfield variable is
not possible.
2.Array of bit fields, not possible.
3.A function cannot return a bit field variable.
| Is This Answer Correct ? | 1 Yes | 1 No |
write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview
2 Answers Satyam, UNIS, Wipro,
How does the assert() function work?
Write a program which returns the first non repetitive character in the string?
main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }
praagnovation
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is strcpy() function?
how can i print "hello".please consider inverted commas as well.i want to print on console: "hello"
can you change name of main()?how?
Explain the difference between struct and union.
What are the different categories of functions in c?
Why is it that not all header files are declared in every C program?