Created
April 27, 2016 05:50
-
-
Save shichao-an/f77f1a8a70f34942d3bd480866d73408 to your computer and use it in GitHub Desktop.
Bit fields
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 <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char * argv[]) | |
{ | |
struct | |
{ | |
bool a: 1; | |
bool b: 1; | |
bool c: 1; | |
} flags = { .b = true }; | |
printf("%s\n", flags.b ? "b.T" : "b.F"); | |
printf("%s\n", flags.c ? "c.T" : "c.F"); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment