The individual elements of a program are called Tokens. In a C program, a number of individual units or elements occur. These elements are called C Tokens. In the C language, the following 6 types of tokens are available:
Each program element in a C program is called an identifier. An identifier is a variable that holds a value and stores it in the memory.
Keywords are words whose meaning has already been defined by the computer – they are pre-defined words in the C compiler.
Each Keyword is meant to perform a specific function in a C program. Keywords are case sensitive and are written in lower case.
The C language has 32 keywords, they are:
A constant is a fixed value that cannot be altered during the execution of a program. C Constants can be classified into two categories:
A primary constant is, again, divided into these three types:
- Numeric is subdivided into two types, Integer and Float.
- Character is subdivided into two types, Single Character and String
The secondary constant is divided into the following types:
Operators are symbols that provide instructions for the performance of various mathematical and logical operations. Operators are tools that can alter data and variable values.
Operators are classified into the following eight types:
All the characters other than a to z, A to Z, and 0 to 9 are special characters. Example: {,},[,],(,)
A character data type consumes 8-bits of memory, which means that one can store anything in a character whose ASCII value lies between -127 and 127. Thus, it can hold any of the 256 different possible values.
A string is a group of characters that should be enclosed in double quotations.
For example: char string[]=“gitam”;
A variable is a user-defined word that, depending on the data type, will have some storage area. The variable’s value will be changed during the program execution, and the data type and its value will be changed during the program execution. The declaration of a variable is:
Datatype var1, var2, ...., varn;
Example: int a
, float a
, char x1
;