cpp tokens

C++ Tokens

AS we know The smallest individual units in a program are knows as tokens, c++ has the following tokens

1. Keywords
2. Identifiers
3. constant
4. strings
5. operators

every c++ program is written using these tokens, white spaces and the syntax of the language. most all the c++ tokens are similar to the c tokens.

Keywords:

The keywords implement specific c++ language features. They are explicitly reserved identifiers and cannot be used as names for the program variable or other user-defined program elements

c++ keywords are following. many of them are common to both c language and c++. The ANSI c keywords are show. Additional keywords have been added to the ANSI C keywords in order to enhance its feature and make it an object oriented language. ANSI C++ standards committee has added some additional keywords to make the language more versatile. These are shown below

auto else new switch
operator temple break enum
private this case extern
throws catch float public
try char for register
typedef class typedef friend
return union const goto
short unsigned continue if
signed virtual default inline
sizeof int delete static
volatile do long struct

C++ Identifier and constant

Identifiers refers to the name of variables, functions, array, classesm etc created by The programmer. They are the fundamental requirement of nay language. Each language has its own rules for the naming these identifiers.

The following rules are common to both c and the c++

1. The name cannot be start with a digit.
2. only alphabet character, digits and underscore are permitted.
3. Uppercase and lowercase letters are distinct.
4. A declare keyword cannot be used as a varibale name.

Some valid Identifiers examples are

number Amount_pay reg1 _data AVERAGE

Some Invalid Identifiers examples are-

6number int reg# 4data AVERAGE no

Constant click here to learn

Operators in c++ click here to learn

  • C++ Dynamic Initialization of Objects
  • C++ Copy Constructor
  • C++ Dynamic Constructor
  • C++ Destructors
  • C++ Exercise
  • C++ Operator Overloading
  • C++ Overloading Unary Operators
  • Const pointer in C
  • Void pointer in c
  • C++ Overloading Binary Operators
  • C++ Overloading Binary Operators Using Friends
  • C++ Manipulation String Using Operators
  • C++ Rules for overloading operators
  • C++ Exercise
  • C++ Basic To class Type
  • C++ Class TO Basic Type
  • C++ One class To another class type
  • C++ Exercise
  • C++ Inheritance introduction
  • C++ Single Inheritance
  • C++ Multiple Inheritance
  • C++ Ambiguity Resolution in inheritance
  • C++ Hierarchical Inheritance
  • C++ Hybrid Inheritance
  • C++ Virtual Base Classes
  • C++ Exercise
  • C++ abstract class
  • C++ nesting of classes
  • C++ Exercise
  • C++ polymorphism
  • C++ Exercise
  • C++ pointers
  • C++ Pointers TO object
  • C++ this pointer
  • C++ Pointer to Derived class
  • C++ Virtual functions
  • C++ Exercise
  • C++ streams
  • C++ unformatted I/O operations
  • C++ Put() and get()
  • C++ getline() and write()
  • C++ Formatted console I/O
  • C++ Manipulators
  • C++ Exercise
  • C++ file handling
  • C++ file stream classes
  • C++ Open and closing file
  • C++ open using constructor
  • C++ open using open()
  • C++ Detecting End of file
  • C++ File modes
  • C++ File pointers and Manipulators
  • C++ Sequential I/O
  • C++ Reading and Writing
  • C++ Updating a File
  • C++ Error handling In File
  • C++ Command Line Arguments
  • C++ Exercise
  • C++ Template introduction
  • C++ Class Templates with multiple Parameters
  • C++ Function templates
  • C++ Function templates with multiple parameters
  • C++ member function Template
  • C++ Exercise
  • C++ Exception handling
  • C++ Basics of Exception Handling
  • C++ Exception Handling Mechanism
  • C++ Throwing Mechanism
  • C++ Catch Mechanism
  • C++ Catch all Exceptions
  • C++ Re-Throwing An Exception
  • C++ Specifying Exceptions
  • C++ Exercise