Tokens


A token is a group of characters that logically belong together. They are like building blocks of a Programming Language.The programmer can write a program by using tokens.
C++ uses the following types of tokens.
1. Keywords
These are some reserved words in C++ which have predefined meaning to compiler called keywords. It is discussed in previous section.

2. Identifiers
Symbolic names(a sequence of alphabets,digits &/or underscores) can be used in C++ for various data items used by a programmer in his program. There are several rules for the formation of an identifier:
  • An identifier can consist of alphabets, digits and/or underscores.
  • It must not start with a digit
  • C++ is case sensitive that is upper case and lower case letters are                considered different from each other.
  • It should not be a reserved word.
3. Literals(Constants)
Data items that never change their value during the execution of the program.You will learn more about them later.
4. Punctuation
The following characters are used as punctuation in C++.
Brackets []Opening and closing brackets indicate single and multidimensional array subscript.
Parentheses ( )Opening and closing brackets indicate functions calls,; function parameters for grouping expressions etc.
Braces { }Opening and closing braces indicate the start and end of a compound statement.
Comma ,It is used as a separator in a function argument list.
Semicolon ;It is used as a statement terminator.
Colon :It indicates a labeled statement or conditional operator symbol.
Asterisk *It is used in pointer declaration or as multiplication operator.
Equal sign =It is used as an assignment operator.
Pound sign #It is used as pre-processor directive.

5. Operators
Operators are special symbols that targets some computation when called and thus have a specific purposes. You will learn more about them later.

Comments

Popular posts from this blog

Getting Started with C++

What is C++?

History Of C++