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 to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal)
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} what would be the output?
What is FIFO?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
what are non standard function in c
How can I get Single byte from 'int' type variable? Can we alter single bit or multiple bits in int type variable? if so, How?
What is a far pointer in c?
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include<stdio.h>...
Can I pass constant values to functions which accept structure arguments?
what is an inline function?