Identifiers, Keywords & Trigraphs in C++

C++ Identifiers

A C++ identifier is a name used to distinguish a variable, function, class, module, or some other user characterized thing.

An identifier begins with a letter a to z or A to Z end or an underscore (_) trailed by at least zero letters, underscores, and digits (0 to 9).

C++ doesn't permit accentuation characters, for example, @, $, and % inside identifiers. C++ is a case-delicate programming language. In this way, Manpower and manpower are two unique identifiers in C++.

Here are a few instances of adequate identifiers −

  • mohd
  • raj
  • abc
  • my_name
  • a_123
  • myname50
  • _temp
  • c
  • a23b9
  • retrnVal

C++ Keywords

The following list shows the reserved words in C++. These reserved words may not be used as constant or variable or any other identifier names.
asm else new this
auto enumoperator throw
bool explicit privatetrue
breakexport protected try
case extern publictypedef
catch false registertypeid
char float reinterpret_cast typename
class for return union
const friend short unsigned
const_cast goto signed using
continue ifsizeof virtual
default inline static void
delete intstatic_castvolatile
do longstruct wchar_t
doublemutableswitch while
dynamic_castnamespace template

Trigraphs

Some of these Trigraphs are removed in year 2017 from c++.

A couple of characters have an elective portrayal, called a trigraph arrangement. A trigraph is a three-character succession that speaks to a solitary character and the arrangement consistently begins with two question marks.

Trigraphs are extended anyplace they show up, including inside string literals and character literals, in comments, and in preprocessor directives.

Following are most oftentimes utilized trigraph sequences −
TrigraphReplacement
??=#
??/\
??'^
??([
??)]
??!|
??<{
??>}
??-~

All the compilers don't support trigraphs and they are not educated to be utilized on the grounds that with respect to their confounding nature.

Whitespace in C++

A line containing just whitespace, conceivably with a comment, is known as a clear line, and C++ compiler thoroughly disregards it.

Whitespace is the term utilized in C++ to portray spaces, tabs, newline characters and comments.

Whitespace isolates one piece of an statement from another and empowers the compiler to recognize where one component in an statement, for example, int, closes and the following component starts.

Statement 1

int age;

In the above statement there must be at least one whitespace character (usually a space) between int and age for the compiler to be able to distinguish them.

Statement 2

fruit = apples + oranges; // Get the total fruit

In the above statement 2, no whitespace characters are necessary between fruit and =, or between = and apples, although you are free to include some if you wish for readability purpose.

You can also see basic Syntax of C++ from here.