In this tutorial, you will learn character set in C, C tokens, C keywords and identifiers in C.
The set of alphabets, digits and special characters that are valid in the C language is called the character set.
Both lowercase(a – z) and uppercase(A – Z) alphabets are accepted by C.
C accepts all digits from 0 to 9.
C supports the usage of the following special characters.
Blank spaces, horizontal tab, carriage return, newline and form feed characters are allowed in C. White spaces may be used to separate words, but they are not permitted between keywords and identifiers.
The smallest individual units in a C program is known as C tokens. C has six types of tokens as shown in the figure.
Predefined reserved words with fixed meanings are called keywords. Since keywords are the building blocks for program statements, they cannot be used as identifiers. Since C is case sensitive, all keywords must be written in lowercase. The list of all keywords available in C is given below:
The names of variables, functions, and arrays are referred to as identifiers. These are user-defined names consisting of a sequence of letters and digits. Identifiers must be unique.
The rules for naming identifiers in C
- Must consist of only letters, digits or underscore.
- Both uppercase and lowercase letters are permitted.
- The first character must be a letter of the alphabet or underscore.
- Only first 31 characters are significant.
- Cannot use a keyword.
- Must not contain white space.
int age; float mark;
Here age and mark are identifiers.