1

In:

struct foo {
  unsigned bar : 2;
};

What does the ': 2' do?

Sverre Rabbelier
  • 1,456
  • 2
  • 16
  • 22

1 Answers1

15

It declares a bit field. The number specifies the size of that member in bits.

Mehrdad Afshari
  • 414,610
  • 91
  • 852
  • 789