3. Hello World – First C++ Program
3. Hello World – First C++ Program
11 Mohannad Al-Kubaisi
C++ Programming
C++ Identifiers
A C++ identifier is a name used to identify a variable, function, class,
module, or any other user-defined item. An identifier starts with a letter A to
Z or a to z or an underscore (_) followed by zero or more letters,
underscores, and digits (0 to 9).
C++ does not allow punctuation characters such as @, $, and % within
identifiers. C++ is a case-sensitive programming language.
Thus, Manpower and manpower are two different identifiers in C++.
Here are some examples of acceptable identifiers −
mohd zara abc move_name a_123
myname50 _temp j a23b9 retVal
12 Mohannad Al-Kubaisi
C++ Programming
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
Whitespace in C++
A line containing only whitespace, possibly with a comment, is known as a
blank line, and C++ compiler totally ignores it.
Whitespace is the term used in C++ to describe blanks, tabs, newline
characters and comments. Whitespace separates one part of a statement
from another and enables the compiler to identify where one element in a
statement, such as int, ends and the next element begins.
13 Mohannad Al-Kubaisi
C++ Programming
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.
14 Mohannad Al-Kubaisi