Use of the : operator in C

Viewed 40816

Possible Duplicates:
What does ‘: number’ after a struct field mean?
What does ‘unsigned temp:3’ means

I hate to ask this type of question, but it's really bugging me, so I will ask:

What is the function of the : operator in the code below?

#include <stdio.h>

struct microFields
{
  unsigned int addr:9;
  unsigned int cond:2;
  unsigned int wr:1;
  unsigned int rd:1;
  unsigned int mar:1;
  unsigned int alu:3;
  unsigned int b:5;
  unsigned int a:5;
  unsigned int c:5;
};

union micro
{
  unsigned int microCode;
  microFields code;
};

int main(int argc, char* argv[])
{
  micro test;
  return 0;
} 

If anyone cares at all, I pulled this code from the link below: http://www.cplusplus.com/forum/beginner/15843/

I would really like to know because I know I have seen this before somewhere, and I want to understand it for when I see it again.

3 Answers
Related