Created
November 10, 2013 12:53
-
-
Save thiagopnts/7397890 to your computer and use it in GitHub Desktop.
Bit field example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct | |
{ | |
unsigned int a: 1; | |
unsigned int b: 1; | |
unsigned int c: 1; | |
} type; | |
int main() | |
{ | |
printf("size: %d\n", sizeof(type)); // 4 bytes | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment