Given a complex data structure where each sub-structure has a variable that has a domain of {true or false},
(e.g.)
struct dataBlock{
struct {
/* more members */
char status;
} node1;
struct {
/* more members */
char status;
} node2;
/* More nodes */
};
It would be a waste to have 1 byte just for a value of 1 or 0. Is there a C language technique that status in each node will only occupy a bit in a byte? What I can think of is by using MACROS but macros cannot be contained in a local scope right? So having macro status will mean only one macro status in the program. Hence, calling node1.status and node2.status uses the same macro.