Lect 1 Week 3
Lect 1 Week 3
FUNDAMENTALS
LAB
Umer Ahmad
Lecture 1
Week 3
IDENTIFIERS , KEYWORDS,
CONSTANT
• 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++ Identifiers • 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++.
Acceptable Identifiers
move_na
mohd Zara abc
me
myname5
a_123 _temp j
0
a23b9 retVal
Invalid Identifiers
• Int
• Pow
• $sum
• Num^3
• Num 1
• 5abc
C++ Keyword
• Thefollowing list shows the reserved words in C++. These
reserved words may not be used as constant or variable or any
other identifier names.
keywords can not be used:
01 02 03 04
Declaring Declaring Declaring Declaring
variable function class objects
name. name. name. name,
CONSTANT
It is an identifier whose value can not be
changed at the execution time of program.
Known as Literals
ESCAPE SEQUENCE
IN C++
Escape Sequences in C++ are used to display special characters in
a string.
• These characters are not displayed in the output.
• Escape Sequences in C++ are used to modify the string.
The list of certain special characters / escape sequence in C++ is as
follow:
ESCAPE SEQUENCES DESCRIPTION
\n
\t
Variables that are declared
inside a function or block are
local variables.
int g;
int main () {
int a, b;
a = 10;
b = 20;
g = a + b;
cout << g;
return 0;