Week 1 Lecture 02
Week 1 Lecture 02
Week 1
IDENTIFIER
■ The identifiers are the names used to represent variable, constants,
functions in the program.
Some important rules for identifier name are as follows:
• The first character must be an alphabetic or underscore (_).
• The identifier name must consist of only alphabetic characters, digits
or underscores.
• The reserve word cannot be used as identifier name.
• C++ is case sensitive
− NUMBER is not the same as number
TYPES OF IDENTIFIERS
1. Standard Identifiers
A type of identifier that has special meaning in C++ is known as standard
identifier.
Example:
cout and cin are examples of standard identifiers.
2. User-defined Identifiers
The type of identifier that is defined by the programmer to access
memory location is known as user-defined identifier.
Example:
Some examples are a, marks and age etc.
KEYWORDS IN C++
Apart from there, we also have void and bool data types.
BUILT-IN DATA TYPES
Examples:
-6728
0
78
+763
Positive integers do not need a + sign
No commas are used within an integer
Commas are used for separating items in a list
bool Data Type
bool type
− Two values: true and false
− Manipulate logical (Boolean) expressions
true and false are called logical values
bool, true, and false are reserved words
char Data Type
#include<iostream>
using namespace std;
int main()
{
cout << "Size of char : " << sizeof(char) << " byte" << endl;
cout << "Size of int : " << sizeof(int) << " bytes" << endl;
cout << "Size of float : " << sizeof(float) << " bytes" <<endl;
cout << "Size of double : " << sizeof(double) << " bytes" << endl;
return 0;
}
CONSTANT IN C++