If you had read my previous articles on Hello, world! C program and Basic Structure of C program then you may observed many new terms that may be unknown to you. In this article I will try to explain different terminologies of C programming language based on C Tokens.
Tokens in C programming language are the basic building blocks of the C programs. Like Human Beings are made up of Cells similarly C programs are made up of C Tokens. A C token is either keywords, strings, constants, identifiers, operators or a Special symbols. For Example in the following statement:
int value = 10;
The tokens are
There are six different types of C Tokens:
- Special Symbols
Constants are those values which remains unchanged or unaltered throughout the program. These are also called as literals. There are different types of constant like Integer constants, Real or Floating point constants, Character constants and String constants or literals.
const int number = 10;
For more about Constants read my article on Constants in C.
Identifiers in C programming are the case-sensitive names given to the variables, functions, array, etc to identify them.
float length = 2.3;
In above example
length is the identifier given to the variable.
For more about Identifiers read my article on Identifiers in C
The keywords in C programming are the reserved words. Since they are reserved words they cannot be used as identifiers. Every keywords has its own special meaning and special function to the C Compiler. Below are the reserved keywords in C programming.
int void else switch return float main const case double extern do union char auto while struct long resister for enum short static goto typedef signed volatile break sizeof unsigned if continue default
Strings are the array of characters terminated by a null character
\0. Strings are always enclosed inside the double quotes whereas characters are enclosed inside single quotes.
char web = "OjhaBikash";
For more about Strings read my article on C Strings
5. Special Symbols
C language contains some special symbols that have their own meaning and function. And these symbols cannot be used for any other purpose. Some examples of Special Symbols are:
This symbol is used to create the pointer variable.
- Pre processer
This symbol is used as a prefix in pre processer directive command. A pre processer is a program that processes the C source code before the compilation.
This symbol is used on the end of the statements to indicate the end of the statement.
They are used in functions to indicate the function call and function parameters.
Braces are used to indicate the start and the end of the block of codes.
They are used to indicate the single and multi-dimentional arrays subscripts.
It is used to seperate more than one statements.
Operaters are the symbols that defines the operation between the operands. Operators helps us to perform specific mathematical and logical operations on the operands. Examples:
For more about Operators read my article on Operators in C