Let us begin our C++ journey by learning what a character set is.

The set of all characters that can be used in a C++ program constitutes the C++ Character Set.

Just as in the English language we have alphabets which are then used to form words, sentences and paragraphs, in C++ too, there is a set of valid characters which are used to form words and then statements and so on.

Now let us see the different components of the C++ Character Set.

1. Letters :

Letters refer to the 26 alphabets that used in the English language. Both uppercase (A-Z) and lowercase (a-z) alphabets can be used in C++.

2. Digits :

Digits from 0-9 or any combination of these can be used in any C++ code.

3. Special Characters/Symbols:

Apart from the usual letters and digits, we have a set of special characters that can be used in C++. All these characters are used for various purposes.

These are:

  • +    –    *   /  ^
  • \   ( )   [ ]   { }
  • =  !=   <  >   <=  >=
  • .   ‘    ”    $  ,   ;   :
  • %  !  &  ?
  • _  #  @
  • Space

4. White Spaces:

These are a special set of characters that are mainly used for the purpose of formatting the text in the C++ program. They are also called formatting characters.

Some common examples are blank space, horizontal tab, newline, carriage return,  vertical tab, form feed etc.

 

So this is all what constitutes the C++ character set. If you have any queries regarding this topic, please do let us know through comments below.



ABOUT THE AUTHOR:

Founder & Senior Editor of ChewCode.com and Editor at GizmoBolt.com. Sakshi is currently pursuing MCA. She is a foodie and has a unique love for learning computer programming languages. Follow her on Google + | Facebook | Twitter. Contact her at [email protected] for feedback and sending tips.


Tags: , , , ,

3 Comments on this article. Feel free to join this conversation.

  1. Rob G April 1, 2015 at 6:14 pm - Reply

    That’s just plain wrong. The “character set” you describe is simply the subset of characters that have special meaning.

    Consider C++ allows Unicode string literals. Any valid Unicode character can be encoded therein.

    • Sakshi Bajaj April 1, 2015 at 10:15 pm - Reply

      Yes we can encode any Unicode character in C++. But here we’re talking about the most basic set of characters most often used to write c++ codes.

      The target audience is beginners who are just going to learn what c++ is.
      That’s why other characters have not been dealt with.

  2. Aarush August 9, 2017 at 4:30 pm - Reply

    Useful!!

Leave A Response