#include <stdio.h>
// Define an enum type named Flags
enum Flags {
FLAG_A = 1, // Define FLAG_A with value 1
FLAG_B = 2, // Define FLAG_B with value 2
FLAG_C = 4, // Define FLAG_C with value 4
FLAG_D = 8 // Define FLAG_D with value 8
};
int main() {
// Declare a variable of type enum Flags
enum Flags myFlags = FLAG_A | FLAG_C; // Set myFlags with FLAG_A and FLAG_C using bitwise OR
// Check if FLAG_A is set in myFlags
if (myFlags & FLAG_A) {
printf("FLAG_A is set\n");
}
// Check if FLAG_B is set in myFlags
if (myFlags & FLAG_B) {
printf("FLAG_B is set\n");
} else {
printf("FLAG_B is not set\n");
}
// Check if FLAG_C is set in myFlags
if (myFlags & FLAG_C) {
printf("FLAG_C is set\n");
}
// Check if FLAG_D is set in myFlags
if (myFlags & FLAG_D) {
printf("FLAG_D is set\n");
} else {
printf("FLAG_D is not set\n");
}
return 0;
}