Which are the C keywords and what is their meaning? The answer is below. But let's first clear the term itself.
Keywords (or reserved words) in programming are language-specific
words that have special meaning. You cannot use them for names of
variables or functions. Note that the term "reserved words" also include
words that are reserved for future extensions of the language.
The meaning of these words is defined by the language. ANSI C had a small set of keywords. They describe the data types, operations and others. In ANSI C there are 32 keywords, the C99 standard adds 5 and C11 adds 7. Additionally, different compilers may define their own (for instance Microsoft’s Visual Studio defines 19 more).
Advertise on this site. I promise you will like the rates :)
Originally, the keywords in C were in lowercase letters only. This was the case with ANSI(which became ISO C90). Later some of the new once started with an underscore and a capital letter. The purpose of this is to keep compatibility with already written code. Since this was an uncommon way for naming in C it is likely that most of the code written through the years does not contain these words.
Note that not all compilers support the new keywords. You should check with your compiler before using the new once. It is certain that it will support the 32 words from the ANSI standard and most of the time this is enough.
As we said, starting with an underscore and a capital letter is not common for reserved words in C. That’s why usually the new words are used through their macros, which keeps the code style clean.
|Keyword||Macro||Macro defined in|
|_Atomic||Depends on the type
(atomic_bool, atomic_char, atomic_int….)
The rest of the words don’t have macros in the standard library.
- Preprocessor directives, used in C language.
- The standard library
- C operators