3

I'm browsing freebsd code and i see this:

i don't understand the use of colon in C

this is an example: u_char ip_hl:4, ip_v:4;

anyone have an idea?

2 Answers2

5

These colons are used to set bit fields of structure members. u_char ip_hl:4 means u_char ip_hl can hold only up to 4 bits.

haccks
  • 100,941
  • 24
  • 163
  • 252
4

This is to do with Bit fields. You can learn more about it by reading here

David Watts
  • 2,199
  • 21
  • 31