Token and White Spaces in cpp
Token in cpp
A token is a language element that is used to form a
statement. Cpp statement may consist of different tokens. Different types of
token are as follows:
Keyword
Keyword is a word in C language that has predefined meaning
and purpose. The meaning and purpose of keyword is defined by the developer of
the language.
Example: For , Double, if ,while, do, else.
Identifiers
Identifiers is the name of a variable of function etc. it is
also called user defined function.
Example: rbatec, item, counter.
Constant
Constant is a quantity that cannot be changed during
execution of a program.
Example: 44 55 333 2
String
Literals
A collection of charecters
written in double quotation is called string or string literal.
Example: “My name is bilal” “rbatec” .
Operators
Operation is a samble that performs some operation. It acts
on different operands
Example: + - / %
Punctuation
Punctuation is symbols that is separate two tokens.
Example: [] () , ; : .
White Spaces
White spaces are used in program to increase readability.
Different types of white spae include space ,tab and carriage return etc.C++
compiler ignores the white spaces. All statement of a program can be written on
one line but it will be difficult to read. The white spaces makes source
program more readable. A single statement can be written on two or more lines
or order to increase readability but it will remain same for the compiler.
Post a Comment