2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
4th February 2013, 02:53 PM
Super Moderator
 
Join Date: May 2012
Re: Bits in C STRUCT

Both C and C++ allow integer members to be stored into lesser memory spaces than the compiler would ordinarily allow. These saving space structure members are called bit fields, and their width in bits can be explicitly declared.

Bit fields are used in programs that force a data structure to correspond to a fixed hardware representation

The syntax for declaring a bit field is as follows:

>>-type_specifier--+------------+--:--constant_expression--;---><
'-declarator-'



A bit field declaration contains a type specifier followed by an optional declarator, a colon, a constant integer expression that indicates the field width in bits, and a semicolon.

A bit field declaration may not use either of the type qualifiers, const or volatile.


Tags
bits pilani

Quick Reply
Your Username: Click here to log in

Message:
Options




All times are GMT +5. The time now is 02:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4