Keywords and Identifiers in C programming language are the building blocks of any C program.
Identifiers in C
In C programming language, the name of variables, functions, labels and user-defined entities are called Identifiers. Each element of a C program are given an identifier. A C identifier can be of any length, there is no limit on the length of the identifiers in C.
- int Interest;
- int getSimpleInterest(int amount);
Interest is an identifier for a variable of integer data type and getSimpleInterest is an identifier for a function.
- An identifier can be composed of alphabets, digits, and underscore only.
- The first character of an identifier must be either an alphabet or underscore.
- Identifier name is case sensitive. Home and home is recognised as two separate identifiers.
- Any special characters other than alphabets, digits, and underscore (such as :, . ,blank space, / are not allowed).
- An identifier cannot be same as a C keyword.
Examples of Valid and Invalid Identifiers
|Valid Identifiers||Invalid Identifiers|
Keywords in C
C keywords are the reserved words which are pre-defined in C language. We cannot use keywords as an identifier for variable or function. Each keyword has a pre-defined meaning for C compiler.
- Trying to use a keyword as an identifier will generate a compilation error.
- All keywords are in lower case letters.
There are 32 keywords defined in C programming language.