C Keywords


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at C Keywords.

Keywords" are words that have special meaning to the C compiler. In translation phases 7 and 8, an identifier cannot have the same spelling and case as a C keyword. (See a description of translation phases in the Preprocessor Reference; for information on identifiers, see Identifiers.) The C language uses the following keywords:


You cannot redefine keywords. However, you can specify text to be substituted for keywords before compilation by using C preprocessor directives.

Microsoft Specific

The ANSI C standard allows identifiers with two leading underscores to be reserved for compiler implementations. Therefore, the Microsoft convention is to precede Microsoft-specific keyword names with double underscores. These words cannot be used as identifier names. For a description of the ANSI rules for naming identifiers, including the use of double underscores, see Identifiers.

The following keywords and special identifiers are recognized by the Microsoft C compiler:

  1. The __based keyword has limited uses for 32-bit and 64-bit target compilations.

  2. These are special identifiers when used with __declspec; their use in other contexts is not restricted.

Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the /Za option (compile for ANSI compatibility) during compilation. When you do this, Microsoft-specific keywords are disabled.

When Microsoft extensions are enabled, you can use the keywords listed above in your programs. For ANSI compliance, most of these keywords are prefaced by a double underscore. The four exceptions, dllexport, dllimport, naked, and thread, are used only with __declspec and therefore do not require a leading double underscore. For backward compatibility, single-underscore versions of the rest of the keywords are supported.

END Microsoft Specific

Elements of C