Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bit fields
#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