tags:

views:

140

answers:

1

In:

struct foo {
  unsigned bar : 2;
};

What does the ': 2' do?

+14  A: 

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

Mehrdad Afshari
+1 - best answer.
Tim Post
Thanks, it makes sense now :).
Sverre Rabbelier