Keywords and Identifiers C
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.
C Keywords:
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.
Example of keyword:
int marks;
List of Keywords in C:
| auto | double | int | struct |
| break | else | long | switch |
| case | enum | register | typedef |
| const | extern | return | union |
| char | float | short | unsigned |
| continue | for | signed | volatile |
| default | goto | sizeof | void |
| do | if | static | while |
Note:
-
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.
What are C Identifiers?
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.
Rules for an Identifier:
-
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";
Here myvariable is the name or identifier for the variable which stores the value "Studytonight" in it.
Example: C Valid Identifiers
total, avg1, difference_1
Example: C Invalid Identifiers
int , char(reserved word)
x+y (special character '+')
Example of Keywords and Identifiers:
int money;
double salary;
Here, money, salary are identifiers, and int, double are keywords.
C Character set
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
:, semicolon;, period., underscore_, ampersand&etc). -
White spaces.
Here is a quick video to explain all about keywords and Identifiers.
Popular Searches:
