W3cubDocs

/C

C keywords

This is a list of reserved keywords in C. Since they are used by the language, these keywords are not available for re-definition.

auto
break
case
char
const
continue
default
do
double
else
enum
extern.

float
for
goto
if
inline (C99)
int
long
register
restrict (C99)
return
short.

signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while.

_Alignas (C11)
_Alignof (C11)
_Atomic (C11)
_Bool (C99)
_Complex (C99)
_Decimal128 (C23)
_Decimal32 (C23)
_Decimal64 (C23)
_Generic (C11)
_Imaginary (C99)
_Noreturn (C11)
_Static_assert (C11)
_Thread_local (C11).

The most common keywords that begin with an underscore are generally used through their convenience macros:

keyword used as defined in
_Alignas (C11) alignas stdalign.h
_Alignof (C11) alignof stdalign.h
_Atomic (C11) atomic_bool, atomic_int, ... stdatomic.h
_Bool (C99) bool stdbool.h
_Complex (C99) complex complex.h
_Decimal128 (C23) (no macro)
_Decimal32 (C23) (no macro)
_Decimal64 (C23) (no macro)
_Generic (C11) (no macro)
_Imaginary (C99) imaginary complex.h
_Noreturn (C11) noreturn stdnoreturn.h
_Static_assert (C11) static_assert assert.h
_Thread_local (C11) thread_local threads.h

Also, each name that begins with a double underscore __ or an underscore followed by an uppercase letter is reserved: see identifier for details.

Note that digraphs <%, %>, <:, :>, %:, and %:%: provide an alternative way to represent standard tokens.

The following tokens are recognized by the preprocessor when they are used within the context of a preprocessor directive:

if
elif
else
endif
.

ifdef
ifndef
elifdef (C23)
elifndef (C23)
define
undef
.

include
line
error
warning (C23)
pragma
.

defined
__has_c_attribute (C23).

The following tokens are recognized by the preprocessor when they are used outside the context of a preprocessor directive:

_Pragma (C99).

The following additional keywords are classified as extensions and conditionally-supported:

asm
fortran.

References

  • C17 standard (ISO/IEC 9899:2018):
    • 6.4.1 Keywords (p: 42-43)
    • J.5.9 The fortran keyword (p: 422)
    • J.5.10 The asm keyword (p: 422)
  • C11 standard (ISO/IEC 9899:2011):
    • 6.4.1 Keywords (p: 58-59)
    • J.5.9 The fortran keyword (p: 580)
    • J.5.10 The asm keyword (p: 580)
  • C99 standard (ISO/IEC 9899:1999):
    • 6.4.1 Keywords (p: 50)
    • J.5.9 The fortran keyword (p: 514)
    • J.5.10 The asm keyword (p: 514)
  • C89/C90 standard (ISO/IEC 9899:1990):
    • 3.1.1 Keywords
    • G.5.9 The fortran keyword
    • G.5.10 The asm keyword

See also

C++ documentation for C++ keywords

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/c/keyword