In a passage of text, individual words and punctuation marks are called tokens, lexical units or lexical elements. C++ has the following tokens :
Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purpose and must not be used as normal identifier names.
Identifiers are fundamental building blocks of a program and are used as the general terminology for the names given to different parts of the program.
The following are some valid identifiers :
The following are some invalid identifiers :
Literals are are data items that never change their value during a program run. C++ allows server kinds of literals :
The bool literal in C++ is used to represent one of the two boolean values (true - boolean true or false - boolean false). Internally boolean true has value of 1 and boolean false has value of 0.
Integer constants are whole numbers with out any fractional part. The method of writing integer constants has been specified in the following rule :
A character constant is one character enclosed in single quotes, as in 'Z' ( Escape Sequences in C++ ) .
Real constants are numbers having fractional parts. The following are valid real constants in fractional form :
The following are invalid real constants :
7- No decimal point
7.- No digit after decimal point
+17/6- '/' Illegal symbol
525.68.01- Two decimal points
5258,01- comma not allowed
'Multiple Character' constants are treated as string literal. A string literal is a sequence of characters surrounded by double quotes ( "abcd" ).
The following characters are used as punctuator is C++:
Opening and closing brackets indicate single and multidimensional array subscripts.
Opening and closing parentheses indicate function calls and function parameters. Parentheses also group expressions and isolate conditional expressions.
Opening and closing braces indicate the start and end of compound statement (block of code containing more than one executable statements).
It is used as a separator in a function arguments lists.
It is used as a statement terminator. Every executable statement is terminated by a semicolon (;).
It indicates a labeled statement.
It is used for pointer declaration and the asterisk is also used as an operator to either pointer or as the multiplication operator.
Ellipsis (...) are used in the formal argument lists of function prototypes to indicate a variable number of argument.
It is used for variable initial and as an assignment operator in expressions.
The pound sign(#) is used for preprocessor directive and double pound sing(##) is also used as operators to perform token replacement and during the preprocessor scanning phase.
Operators and Expressions - Operators are tokens that trigger some computation when applied to variables and other objects in an expression. The following list gives a brief description of the operators and their functions :
Unary operator are those operators that require one operator to operate upon. following are some unary operators :
Binary operators are those operators that require two operands to operate upon. following are some binary operators :
|%||Remainder / Modulus|
|^||Bitwise exclusive OR (XOR)|
|<<=||Assign left shift|
|&=||Assign bitwise AND|
|>>=||Assign right shift|
|^=||Assign bitwise or (XOR)|
|<=||Less than or equal to|
|>=||Greater than or equal to|
|!=||Not equal to|
|Component selection Operators|
|Direct component selector|
|Indirect components selector|
|Class member Operators|
|.*||Deference pointer to class member|
|-->*||Deference pointer to class member|
|Escape Sequence||Non-graphic Character|
|\a||Audible bell (alert)|
|\n||Newline or linefeed|
It's a special area where you can find special questions and answers for CSE students or IT professionals. Also, In this section, we try to explain a topic in a very deep way.