0% found this document useful (0 votes)
20 views12 pages

4.CPP Notes Part 4 Some Imp Terms

Identifiers are names used to identify variables, functions etc in C++. They start with a letter or underscore, followed by letters, digits or underscores. Keywords like if, else, switch etc are reserved and cannot be used as identifiers. Variables are used to store values in memory. They have a type like int, float, char which determines their size and value range. Operators perform operations on variable values and include arithmetic, relational, logical and assignment operators.

Uploaded by

luuxz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views12 pages

4.CPP Notes Part 4 Some Imp Terms

Identifiers are names used to identify variables, functions etc in C++. They start with a letter or underscore, followed by letters, digits or underscores. Keywords like if, else, switch etc are reserved and cannot be used as identifiers. Variables are used to store values in memory. They have a type like int, float, char which determines their size and value range. Operators perform operations on variable values and include arithmetic, relational, logical and assignment operators.

Uploaded by

luuxz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Some Imp.

Terms
C++ Programming
Identifiers

Identifier is a name used to identify a


variable, function, class, module, or any
other user-defined item.

Identifier starts with a letter A to Z or a to z


or an underscore (_) followed by more letters
Chef Doctor or digits (0 to 9)

NOTE :- C++ does not allow punctuation


vedinesh ve123 _vedinesh
characters such as @, $, and % within
identifiers
ved@inesh $academy 123Ve
Keywords
The reserved words in C++
asm else new this
auto enum operator throw
bool explicit private true
break export protected try
case extern public typedef
catch false register typeid
char float typename
class for return union
const friend short unsigned
const_cast goto signed using
continue if sizeof virtual
default inline static void
delete int static_cast volatile
do long struct wchar_t NOTE :-
double mutable switch while Reserved words can't be
dynamic_cast namespace template used as identifier names.
Data Type
Data Type Size

Built-in Types
True / False Type Keyword 9.1111119
1 byte Boolean --> bool 8 byte
Character --> char
Integer --> int
Floating point --> float
Double floating point --> double
'c' , 'd' , 'D' Valueless --> void 10.6f, 0.01f
1 byte 4 byte

1000, 56, 1
2 byte
Data Types
Built-in Types
Type Keyword
Boolean --> bool
Character --> char
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Integer --> int
Floating point --> float
Double floating point --> double
MSB
Valueless --> void
LSB

Type Size Range


1 means -ve
bool 1 byte
0 means +ve char 1 byte -128 to 127
int 2 byte -32768 to 32767
float 4 byte -3.4 * to 3.4 *
double 8 byte - 1.7 * to 1.7 *
Variable
bool fan = true;

char gender = 'M';

int age = 45;

float height = 5.10f;


Variable is a container that are used for storing data values.

A variable is a name which is associated with a value that can be double salary = 51000.99191;
changed.
Variable

int Age = 45;

Main Memory
Age
2000 0100 1100

2001 0101 1011


Variable Scope

Local Global

{ int age = 25

int main( )
{
int age;

} }
Inside Block Not inside any Block
Operators
int marks1 = 95; Main Memory
marks
2000 0100 1100

int marks2 = 89; 2001 0101 1011

float percentage;
percentage = ((marks1 + marks2) / 200 ) * 100;

Operators are used to perform operations on values referred by variables.


Operators

Arithmetic Assignment
Operator Example Ope. Example Same As

+ x+y = x=5 x=5


- x-y += x+=5 x=x+5
* x*y -= x-=5 x=x-5
/ x/y *= x*=5 x=x*5
% x%y
/= x/=5 x = x /5
++ ++x x++
%= x %= 5 x = x %5
-- --x x--
Operators

Logical Comparison
Operator Example Description Operator Example
&& x < 5 && x < 10 Returns true if both == x == y
statements are true != x!=y
|| x < 5 || x < 4 Returns true if, one of > x>y
the statements is true
< x<y
! Reverse the result ( !True ) = False
>= x>=y
<= x<=y

You might also like