I am trying to implement boolean data type in C. Basically, I am working with sets.
The following code can be used to access each bit but I am unsure whether I can represent sets using this method. Can somebody clarify this for me?
struct SET {
unsigned int b0 :1; // bit 0 single bit
unsigned int b1 :1; // bit 1 single bit
unsigned int b2 :1;
unsigned int b3 :1;
};
I can define two structures s1 and s2.. and I will be able to access each bit of these structures (treated as boolean strings).
I will have to perform set operations like UNION, INTERSECTION and MEMBERSHIP. Is this even possible in C?
Note: I cannot use Java, only C.