Tokens in C are defined as the smallest individual element in C and are the basic building blocks of creating a program. It is classified into the following categories. Here, we will study keywords and identifiers. Before proceeding further do check the following topics:
Here is a quick video to explain all about keywords and Identifiers. Click Here.
Keywords are reserved words that have special meaning in the C language. The meaning of C language keywords has already been described in the C compiler. These meanings cannot be changed. Thus, keywords cannot be used as Variables names because that would try to change the existing meaning of the keyword, which is not allowed. There is a total of 32 keywords in the C language.
A keyword name can not be used as a variable name.
Keywords must be written in lower case.
It specifies the type/kind of entity.
In C language identifiers are the names given to variables, constants, functions, and user-defined data. These identifiers are defined against a set of rules.
An Identifier can only have alphanumeric characters(a-z , A-Z , 0-9) and underscore(
The first character of an identifier can only contain alphabet(a-z, A-Z) or underscore (
Identifiers are also case sensitive in C. For example, name and Name are two different identifiers in C.
Keywords are not allowed to be used as Identifiers.
No special characters, such as a semicolon, period, whitespaces, slash, or comma are permitted to be used in or as an Identifier.
When we declare a variable or any function in C language program, to use it we must provide a name to it, which identified it throughout the program, for example:
int myvariable = "Studytonight";
myvariable is the name or identifier for the variable which stores the value "Studytonight" in it.
total, avg1, difference_1
int , char(reserved word) x+y (special character '+')
int money; double salary;
Here, money, salary are identifiers, and int, double are keywords.
In C language characters are grouped into the following categories,
Letters(all alphabets a to z & A to Z).
Digits (all digits 0 to 9).
Special characters, ( such as colon
Here is a quick video to explain all about keywords and Identifiers.