Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to declare an unsigned int in a C program

Tags:

c

bit-fields

On this link I came across http://lxr.linux.no/#linux+v2.6.36/include/linux/pci.h#L299 integer declaration unsigned int is_added:1;I have made C programs and declared integers in them but in the above I see use of : What sort of syntax is that?

like image 203
reality displays Avatar asked Nov 23 '10 06:11

reality displays


2 Answers

I think you have come across a bit-field :)

like image 51
Armen Tsirunyan Avatar answered Nov 15 '22 06:11

Armen Tsirunyan


It's part of a struct, which means that it indicates that the field should only use a certain number of bits instead of an entire byte or more.

like image 37
Ignacio Vazquez-Abrams Avatar answered Nov 15 '22 06:11

Ignacio Vazquez-Abrams