Tokens are the basic building blocks in C that are constructed to write a program. Whereas, variables are nothing but a name given to a storage area that a program can manipulate

C Tokens

C tokens are the basic building blocks in the C language which are constructed together to write a C program. Every smallest individual unit in a C program is known as a C token. C tokens are of six types. They are:-
1. Keywords (eg: int, while),
2. Identifiers(eg: main, total),
3. Constants (eg: 10, 20),
4. Strings (eg: ―total‖, ―hello‖),
5. Special symbols (eg: (), {}),
6. Operators (eg: +, /,-,*)


C keywords are the words that convey a special meaning to the c compiler. We can not use keywords as variable names. The list of C keywords is:


Identifiers are used as the general terminology for the names of variables, functions, and arrays. These are user-defined names consisting of arbitrarily long sequences of letters and digits with either a letter or the underscore() as a first character. Certain rules should be followed while naming c identifiers:

  • They must begin with a letter or underscore ().
  • They must consist of only letters, digits, or underscore.
  • No other special character are allowed to use as identifiers.
  • It must not contain white space.
  • It should be up to 31 characters long as only the first 31 characters are significant.


A-C constant refers to the data items that do not change their value during the program execution. Several types of C constants are:

Integer Constants:

Integer constants are whole numbers without any fractional part. It must have at least one digit and may contain either + or – sign. A number with no sign is assumed to be positive. There are three types of integer constants

Decimal Integer Constants:

Integer constants consisting of a set of digits, 0 through 9, preceded by an optional – or + sign. Example of valid decimal integer constants
341, -341, 0, 8972

Octal Integer Constants:

Integer constants consisting of a sequence of digits from the set 0 through 7 starting with 0 are octal integer constants. Examples of valid octal integer constants are:
010, 0424, 0, 0540

Hexadecimal Integer Constants:

Hexadecimal integer constants are integer constants having a sequence of digits preceded by 0x or 0X. They may also include alphabets from A to F representing numbers 10 to 15. Examples of valid hexadecimal integer constants are: 0xD, 0X8d, 0X, 0xbD.

Note: Most programmers rarely use octal and hexadecimal integer constants.

Real Constants:

The numbers having fractional parts are called real or floating-point constants. These may be represented in one of the two forms called fractional or exponent forms and may also have either + or – sign preceding them.

Example of valid real constants in fractional form or decimal notation
0.05, -0.905, 562.05, 0.015

Representing a real constant in exponent form:

The general format in which a real number may be represented in exponential or scientific form is
mantissa e exponent
The mantissa must be either an integer or a real number expressed in decimal notation. The letter e separating the mantissa and the exponent can also be written in uppercase i.e. E And, the exponent must be an integer. Examples of valid real constants in exponent form are:
252E85, 0.15E-10, -3e+8

Character Constants:

A character constant contains one single character enclosed within single quotes. Examples of valid character constants ‗a‘, ‗Z‘, ‗5‘
It should be noted that character constants have numerical values known as ASCII values, for example, the value of ‗A‘ is 65 which is its ASCII value

Escape Characters/ Escape Sequences:

C allows us to have certain nongraphic characters in character constants. Nongraphic characters are those characters that we cannot type directly from the keyboard, for example, tabs, carriage return, etc.
These nongraphic characters are represented by using escape sequences represented by a backslash() followed by one or more characters.
NOTE: An escape sequence consumes only one byte of space as it represents a single character.


String constants are sequences of characters enclosed within double-quotes.

For example,
Every string constant is automatically terminated with a special character „called the null character which represents the end of the string.
For example, ―hello‖ will represent ―hello‖ in the memory. Thus, the size of the string is the total number of characters plus one for the null character.

5. Special Symbols

The following special symbols are used in C having some special meaning and thus, cannot be
used for some other purpose. [] () {} , ; : * … = #
Braces{}: These opening and ending curly braces mark the start and end of a block of code containing more than one executable statement.
Parentheses(): These special symbols are used to indicate function calls and function parameters.
Brackets[]: Opening and closing brackets are used as array element references. These indicate single and multidimensional subscripts.

6. Operators

For operators, kindly read this article, operators are the same in C and in C++ language


A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.
The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there will be the following basic variable types

C programming language also allows defining various other types of variables like Enumeration, Pointer, Array, Structure, Union, etc.

Variable Definition in C

A variable definition tells the compiler where and how much storage to create for the variable. A variable definition specifies a data type and contains a list of one or more variables of that type as follows −

Here, the type must be a valid C data type including char, w_char, int, float, double, bool, or any user-defined object; and variable_list may consist of one or more identifier names separated by commas. Some valid declarations are shown here −
The line int i, j, k; declares and defines the variables i, j, and k; which instructs the compiler to create variables named i, j, and k of type int.
Variables can be initialized (assigned an initial value) in their declaration. The initializer consists of an equal sign followed by a constant expression as follows −
Some examples are −
For definition without an initializer: variables with static storage duration are implicitly initialized with NULL (all bytes have the value 0); the initial value of all other variables are undefined. type variable_list;

int i, j, k;
char c, ch;
float f, salary;
double d;
type variable_name = value;
extern int d = 3, f = 5; // declaration of d and f.
int d = 3, f = 5; // definition and initializing d and f.
byte z = 22; // definition and initializes z.
char x = ‘x’; // the variable x has the value ‘x’.

Variable Declaration in C

A variable declaration provides assurance to the compiler that there exists a variable with the given type and name so that the compiler can proceed with further compilation without requiring complete detail about the variable. A variable definition has its meaning at the time of compilation only; the compiler needs actual variable definition at the time of linking the program. A variable declaration is useful when multiple files are used



Write a comment