You can only use a bit field inside a struct. And it would only make sense if you had multiple booleans to represent. It's really just for saving space.
Code:
#include <stdio.h>
typedef struct Status {
unsigned char a:1, b:1, c:1, d:1;
} Status;
int main() {
Status st = {1,0,0,1};
printf("value: %d%d%d%d\n", st.a, st.b, st.c, st.d); // prints 1001
printf("bytes: %zu\n", sizeof st); // prints 1
}
Using an int for a boolean is okay, but it does mean that it's less clear that's what it is (although the name should be a big hint). To make it more clear, many people would do something like this:
Code:
enum BOOL { FALSE, TRUE };
C99 added stdbool.h in order to standardize this useful practice, choosing the same identifiers as C++: bool, false, and true. So it is an excellent idea to use stdbool.h and all modern C compilers will "allow" it as long as you tell them that you want (at least) the C99 standard.