C
letterAttribute
호타리
2023. 9. 1. 09:35
#include <stdio.h>
//#define BOLD 0x01
#define BOLD (0x01 << 0)
#define ITALIC (0x01 << 1)
#define SHADOW (0x01 << 2)
#define UL (0x01 << 3)
int main(void)
{
unsigned char attr;
attr = attr ^ attr; // attr = 0;
attr = attr | BOLD; // 00000001
attr = attr | (SHADOW + ITALIC); // 00000110
attr = attr & ~BOLD;
printf("attr: 0x%02x\n", attr);
return 0;
}
<compile 결과>
