get flag status c code
#include <stdio.h>
#define FLAG_MASK 0x01
int main() {
unsigned char status = 0; // Assume flag is initially not set
// Set the flag
status |= FLAG_MASK;
// Check if the flag is set
if (status & FLAG_MASK) {
printf("Flag is set.\n");
} else {
printf("Flag is not set.\n");
}
// Unset the flag
status &= ~FLAG_MASK;
// Check if the flag is set
if (status & FLAG_MASK) {
printf("Flag is set.\n");
} else {
printf("Flag is not set.\n");
}
return 0;
}