컴퓨터/C
C 변수 선언명 변경하기
Begi
2022. 5. 2. 22:49
반응형
char, short, int 등의 변수 선언명을 typedef을 사용하여 다음과 같이 변경할 수 있다.
typedef signed char s08; typedef unsigned char u08; typedef signed short s16; typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; typedef signed long s64; typedef unsigned long u64; typedef float f32; typedef double f64; |
임베디드 시스템에서 MCU 마다 변수의 크기가 다를 때 변수 선언명을 위와 같이 정의하여 사용하면 다른 MCU로 쉽게 포팅할 수 있다.
또한, 변수 선언명의 글자가 모두 3개로 프로그래밍할 때 줄을 쉽게 맞출 수 있다.
반응형