C++ Character Set

                                C++ Character Set

      Character Set is a set of valid Characters that a language can               recognize.

  • Letters  A-Z, a-z
  • Digits 0-9
  • Special Characters  Space + - * / ^ \  () [] {} = != <> ' " $ , ? _ # <= >= @
  • Formatting Characters  Backspace, Horizontal Tab, Vertical Tab, Form Feed,                 Carriage Return.
      White Space Characters

  • A character that is used to produce blank space.
  • These are spaces, tabs, new lines and comments.
     Tokens: A Token is a group of characters.

      C++ Uses the following types of tokens:-

      *Keyword
        *Identifiers
        *Literals
        *Punctuators
       *Operators

      Identifiers- The Identifier is a sequence of characters taken from C++ character               set.
      The Rules for creation of an Identifier are:

  1. An Identifier can consist of alphabets, digits and underscores.
  2. It must not start with a digit.
  3. C++ is case sensitive.
  4. It should not be a reserved word(keyword).
     Keyword-These are some reserved words in C++ which have predefined meanings          to compiler, these words are known as keywords. We can't change the meanings of the          keyword.


    Literals or Constants-A number which does not change its value during                    execution of a program is known as a constant or literals.
     Operator- An operator is a symbol that tells the compiler to perform specific                   mathematical or logical manipulations.
       *Arithmetical Operators
       *Relational Operators 
       *Logical Operators
       *Bitwise Operators 
       *Precedence of Operators
       *Special Operators
       *Escape Operators

     Arithmetical Operators-An Operator that performs an arithmetic operation            such as+,-,*,/ or % is called arithmetic operator.

      Relational Operator
  • The Relational Operators are used to test  the relation between two values.
  • All Relational Operators are binary operators and require two operands.
  • Example  :    ==   !=   >     <    >=     <=


     Logical Operators-It takes true/false value as operands and compute new true/false value.
       Example   &&-Logical AND
       ||- Logical OR
        !- Logical NOT


    Bitwise Operators-Bitwise Operator works on bits and perform bit by bit                    operation.
      Example   &-bitwise AND
      |-bitwise OR
     ^-bitwise exclusive  or(XOR)
     ~-bitwise negation and compliment.
    Special Characters(Increment & Decrement)
  • The increment operator (++) adds 1 to its operand and the decrement operator (--) subtracts 1 from its operand.
  • x=x+1;is same as x++;
  • x=x-1;is the same as x--;
  • Both the increment and decrement operator can either precede (prefix) or follow (postfix) the operand.
  • x++,x-- Post Increment/Decrement
  • ++x,--x Pre Increment/Decrement
   Escape Sequence-An Escape Sequence is represented by  backslash(\) followed          by one more character.



Comments

C++ Character Set

Lets Start With C++