STUDY/C++

C/C++ 예약어(reserved word, keyword)

Trip the light 2021. 11. 10. 04:22

1. 컴파일러에 의해 미리 의미가 정해져 있는 32~44개의 단어
2. 항상 소문자로만 사용(C99 이전)
3. C99에서 추가된 예약어 - inline, restrict, _Bool, _Complex, _Imaginary

기능별 분류 예약어
제어문 - 반복 for, while, do
제어문 - 선택 if, else, switch, case, default
제어문 - 점프 break, continue, goto, return
자료형 char, int, short, long, float,double, unsigned, struct, union, typeof, enum, void
기억 클래스 auto, static, extern, register
기타 const, sizeof, volatile

4. 총 44개

  • C99 이전까지 32개
  • C99에서 5개 추가
  • C11에서 7개 추가
auto
break
case
char
const
continue
default
do
dobule
else
enum
extern
float
for
goto
if
inline(since C99)
int
long
register
restrict(since C99)
return
short
signed
sizeof
static
struct
switch
typeof
union
unsigned
void
volatile
while
_Alignas(since C11)
_Alignof(since C11)
_Atomic(since C11)
_Bool(since C99)
_Complex(since C99)
_Generic(since C11)
_Imaginary(since C99)
_Noreturn(since C11)
_Static_assert(since C11)
_Thread_local(since C11)