-=> Quoting Rick Bischoff to All <=-
Hey Rick:
RB> Does anyone know how to declare a variable that holds only one bit of
RB> information.. (You know only two values (0 or 1)) ???
RB> Thanks..
Sure, but I believe the bit field must be part of a structure
definition. For example, Let's suppose you wanted to define a
variable that had a number of single-bit fields. You could define
it like this:
typedef struct {
int bit0 :1; // This field is 1 bit.
int bit1 :1; // Also 1 bit.
int bit2_7 :6; // 6-bit field.
char bit8_f; // 8 bit field.
} BitMap;
You would then declare a variable of type BitMap and address the
individual elements as you would in any structure definition, but the
individual fields would only hold values valid for their size.
-bwr-
... Fidonet: The Information Winding Country Road.
--- GEcho 1.20/Pro
---------------
* Origin: (1:363/319)
|