Namespaces
Variants
Views
Actions

C keywords

From cppreference.com
< c
Revision as of 03:30, 19 January 2015 by Newatthis (Talk | contribs)

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 (since C99)
int
long
register
restrict (since C99)
return
short

signed
sizeof
static
struct
switch
typedef
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)

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

keyword used as defined in

_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)

alignas
alignof
atomic_bool. atomic_int, ...
bool
complex

imaginary
noreturn
static_assert
thread_local

stdalign.h
stdalign.h
stdatomic.h
stdbool.h
complex.h
(no macro)
complex.h
stdnoreturn.h
assert.h
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
defined

ifdef
ifndef
define
undef

include
line
error
pragma

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

_Pragma(since C99)

See also

C++ documentation for C++ keywords