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 |
how would a 4*3 array A[4][3] stored in Row Major Order?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
0 Answers Amdocs, Apps Associates,
If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
We can draw a box in cprogram by using only one printf();& without using graphic.h header file?
how to find anagram without using string functions using only loops in c programming
Is c a great language, or what?
What does c in a circle mean?
What is structure padding in c?
How can I get the current date or time of day in a c program?
What is the memory allocated by the following definition ? int (*x)();
Program to display given 3 integers in ascending order
Why do we write return 0 in c?