What are bit fields? What is their use?

Answers were Sorted based on User's Feedback



What are bit fields? What is their use?..

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

What are bit fields? What is their use?..

Answer / vadivel t

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

Post New Answer

More C Interview Questions

Explain what is operator promotion?

0 Answers  


How can I read in an object file and jump to locations in it?

0 Answers  


Subtract Two Number Without Using Subtraction Operator

0 Answers  


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

0 Answers  


Why is c used in embedded systems?

0 Answers  






write a c program to calculate the income tax of the employees in an organization where the conditions are given as. (I.T. = 0 if income <100000 I.T = 10% if income _< 200000 it = 20% if income >_ 200000)

7 Answers   Consultancy, DBU, FD, JK Associates, Kobe, Satyam,


Explain how do you list a file’s date and time?

0 Answers  


Differentiate between null and void pointers.

0 Answers   TCS,


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

0 Answers  


What are the functions to open and close file in c language?

0 Answers  


Explain the properties of union.

0 Answers  


Do you know what are bitwise shift operators in c programming?

0 Answers  


Categories