It looks like you're new here. If you want to get involved, click one of these buttons!
#define BACON_CATEGORY (0x00000001) #define FRUIT_CATEGORY ((0x00000001)<<1) #define BADDIE_CATEGORY ((0x00000001)<<2)
ryantcb wrote: » Ok Thank you. What would be the reason to use 0x00000001 and not just 0x1?
Replies
Bacon is 1, Fruit is 2 because it starts as 1 and gets shifted over a bit, and Baddie is 4 because it starts as 1 and gets shifted over 2 bits.
Binary numbers start with 0b, although that is only a recent addition to the language. So the same thing could be written as 0b1, 0b10, and 0b100.