C Reserved Words
C Reserved Words
In this tutorial, we will learn about C Reserved words or keywords. C keywords are predefined words that are already defined and have special meanings.
C Reserved Words
C Keywords are words that are part of the C Language. These words have predefined meanings and these words cannot be used as variable names in the C Program.
In the C language, there are 32 keywords defined by the ANSI C (C89/C90) standard. These keywords are reserved and have special meaning in the language. You cannot use them as identifiers (like variable names).
C Keywords |
|||
char | signed | break | for |
auto | const | sizeof | case |
if | extern | double | struct |
continue | goto | register | enum |
typedef | default | return | static |
float | union | do | switch |
volatile | int | unsigned | else |
while | long | void | short |
Some newer versions of C (like C99, C11, C18) introduce additional keywords, but the core C language (C89/C90) has 32 keywords.
The IDE software like Code::Blocks IDE highlights the C keywords with a different color. This is to increase the readability of the source code.
Example
In this example, the programmer is trying to declare and create a variable with the variable name case. However, the case is a C keyword. We cannot have the keyword as the variable name. The compiler throws an error expected identifier. The C compiler expects a valid identifier name.
Notice that the C keywords int, case, and return words are highlighted with dark blue color in the example.
C Tutorials
C Tutorials on this website can be found at: