The portable way is the definition of a variable which individual bits are used as flags.
#define FLAG_FOO 0
#define FLAG_BAR 1
// in case platform does not support uint8_t
typedef unsigned char uint8_t;
uint8_t flags;
void flag_foo_set()
{
flags |= (1 << FLAG_FOO);
}
void flag_foo_clr()
{
flags &= ~(1 << FLAG_FOO);
}
uint8_t flag_foo_get()
{
return flags & (1 << FLAG_FOO);
}
While this can seem superfluos compared to C bit fields. It is portable to basically every ANSI C compiler.