- Keyword
- Keywords are words that have special meaning to the compiler and may not be used as identifiers.
While we have extensive leeway with respect to the names we can use for identifiers, some words cannot under any circumstances be used as identifiers. These are known as "keywords".
ANSI C Keywords
auto | break | case | char |
const | continue | default | do |
double | else | enum | extern |
float | for | goto | if |
int | long | register | return |
short | signed | sizeof | static |
struct | switch | typedef | union |
unsigned | void | volatile | while |
These 32 keywords have specific meanings in ANSI C and, as such, may not be used for anything other than their intended purpose. In any ANSI C implementation, these keywords will have the exact same meanings which we will explore throughout the rest of this class. However, some compilers deviate from the standard ANSI implementation, resulting in potential differences in the behavior of some keywords.
Some compiler implementations may define additional keywords. While these extra keywords are not part of the ANSI C standard, they will have the same restrictions as the ANSI keywords in their compiler toolchain. The Microchip MPLAB® XC16 compiler, for example, defines 12 additional keywords. These and any other compiler-specific keywords will be covered in the compiler classes.