An example of bit fields in structures in C

The declaration specifies a variable called flags with four one-bit fields. The bit-field width is specified by specifying the width of the field as an integer after a colon, following the member variable identifier.

struct {
      int sign:1;
      int carry:1;
      int zero:1;
      int parity:1;

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.