If you don't need millions of these flags or have extremely limited memory constraints, the best way is definitively an int
.
This is because an int
normally corresponds to the natural word size of your platform and can, properly aligned, be accessed quickly. The machine reads a word at a time anyways and using the single bits requires masking and shifting, that costs time. On your typical PC with gigabytes of RAM, this would be just silly.
If memory consumption really is an issue, there are bitfield structures.