English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
In this tutorial, you will learn about keywords. Reserved words in C programming that are part of the syntax. In addition, you will also learn about identifiers and their naming methods.
The character set is a set of letters, numbers, and special characters that are valid in the C language.
Uppercase letters: A B C ... X Y Z Lowercase letters: a b c ... x y z
C accepts both lowercase and uppercase letters as variables and functions.
0 1 2 3 4 5 6 7 8 9
, | < | > | . | _ |
( | ) | ; | $ | : |
% | [ | ] | # | ? |
' | & | { | } | " |
^ | ! | * | / | | |
- | \ | ~ | + |
Space character
Spaces, newlines, horizontal tabs, carriage returns, returns, and form feeds.
Keywords are predefined reserved words used in programming that have special meaning to the compiler. Keywords are part of the syntax and cannot be used as identifiers. For example:
int money;
Here, 'int' is a keyword indicating that it isVariable money is of int (integer) type.
Since C is a case-sensitive language, all keywords must be written in lowercase. This is the list of all keywords allowed in ANSI C.
auto | double | int | struct |
break | else | long | switch |
case | enum | register | typedef |
char | extern | return | union |
continue | for | signed | void |
do | if | static | while |
default | goto | sizeof | volatile |
const | float | short | unsigned |
All these keywords, their syntax, and applications will be discussed in their respective topics. If you want to view all the keywords in C language, please visitList of all keywords in C programming.
An identifier is a name given to an entity, such as a variable, function, structure, etc.
Identifiers must be unique. They are created to provide a unique name for entities so that they can be identified during program execution. For example:
int money; double accountBalance;
Here, 'money' and 'accountBalance' are identifiers.
Remember that the name of an identifier must be different from keywords. Since 'int' is a keyword, 'int' cannot be used as an identifier.
A valid identifier can contain letters (both uppercase and lowercase), numbers, and underscores.
The first character of an identifier should be a letter or an underscore.
Keywords cannot be used as identifiers.
The length of the identifier is not specified. However, if the identifier exceeds31characters, there may be problems in some compilers.
If the above rules are followed, any name can be chosen as an identifier, but it is recommended to use meaningful identifiers to specify meaningful variable names.