# Other Languages > C and C++ >  What do the colon and number mean in this struct definition?

## Ben321

I was looking at this one struct definition in the Windows API, and several of the fields in the struct have a colon and a number after the field type and field name. What does that colon and number mean?

https://learn.microsoft.com/en-us/wi...inbase-comstat



```
typedef struct _COMSTAT {
  DWORD fCtsHold : 1;
  DWORD fDsrHold : 1;
  DWORD fRlsdHold : 1;
  DWORD fXoffHold : 1;
  DWORD fXoffSent : 1;
  DWORD fEof : 1;
  DWORD fTxim : 1;
  DWORD fReserved : 25;
  DWORD cbInQue;
  DWORD cbOutQue;
} COMSTAT, *LPCOMSTAT;
```

----------


## Zvoni

https://learn.microsoft.com/en-us/cp...&view=msvc-170
https://stackoverflow.com/questions/...t-does-it-mean

----------


## Ben321

> https://learn.microsoft.com/en-us/cp...&view=msvc-170
> https://stackoverflow.com/questions/...t-does-it-mean


COOL! I didn't know you could address individual bits in any programming language. I thought you needed to use bitwise arithmetic to isolate single bits or sets of bits within a byte. In Visual Basic 6 for example, to get the 5th bit (bit4) you would do:


```
'for a 1-bit bitfield starting on the 5th bit
bf1 = (bitfields\16) And 1

;for a 2-bit bitfield starting on the 5th bit
bf2 = (bitfields\16) And 3
```

----------


## 2kaud

Note that this c/c++ method for individual bits can only be used within a struct/class. Also, you have to be careful of endian layout and padding - especially if you're trying to match to eternal data.

----------


## Zvoni

> COOL! I didn't know you could address individual bits in any programming language. I thought you needed to use bitwise arithmetic to isolate single bits or sets of bits within a b. In Visual Basic 6 for example, to get the 5th bit (bit4) you would do:
> 
> 
> ```
> 'for a 1-bit bitfield starting on the 5th bit
> bf1 = (bitfields\16) And 1
> 
> ;for a 2-bit bitfield starting on the 5th bit
> bf2 = (bitfields\16) And 3
> ```


Look here (Freepascal/Delphi): https://www.freepascal.org/docs-html...ses/tbits.html

----------


## fafalone

I'd add to this a note that if you're translating these to VB for use with APIs,



```
Public Type COMSTAT
    dwBitfield As Long
    cbInQueue As Long
    cbOutQueue As Long
End Type
```

You add up the bits; they're not separate variables of which only 1 bit is used.

----------

