csyntaxbit-fields

Colons after variable name in C


This is C code sample of a reference page.

      signed int _exponent:8;

What's the meaning of the colon before '8' and '8' itself?


Solution

  • It's a bitfield. It's only valid in a struct definition, and it means that the system will only use 8 bits for your integer.