SlideShare a Scribd company logo
OPERATORS
IN
C++
K.THAMIZHSELVI
Asst. Prof. of Computer Science
Bon Secours College for Women, Thanjavur
Other New Operators
• Scope Resolution Operator (::)
• Pointer to member Declarator (::*)
• Pointer to Member Operator (-> , .*)
• Memory release Operator (delete)
• Memory Allocation Operator (new)
• Line feed Operator (endl)
• Field width Operator (setw)
Scope Resolution Operator
:: variable name
Global variable can be access from within the
inner block using Scope resolution operator.
Member Dereferencing Operators
• C++ allow to define class of different data
types and functions.
• Also permit to access class member through
pointers.
• 3 types:
– Pointer to member Declarator (::*)
– Pointer to Member Operator (-> , .*)
Memory Management Operators
• Unary operators new and delete
• Alice known as free store operators.
• An object created by new and destroyed by
delete.
• GF:
Pointer variable = new data type;
Pointer variable = new data type(value);
Pointer variable = new data type[size];
a = new int;
int *p = new int; (or) *p = 25;
Int *p = new int (25);
Int *p = new int [10];
• Delete:
When the data object is not needed, it is
destroyed by using delete operator to free up
the memory space.
GF:
delete pointer variable;
delete [size] pointer variable;
delete p;
delete [] p;
Manipulators
• endl – output statement – new line character
• setw – to display in right justification – specify
the width
• Eg: cout<< setw(5) <<sum <<endl;
3 4 5
EXPRESSIONS
• Combination of operators, constants and
variables.
• 7 types:
– Constant expression
– Integer expression
– Float expression
– Pointer expression
– Relational expression
– Logical expression
– Bitwise expression
SPECIAL ASSIGNMENT EXPRESSION
• Chained Assignment
x = y = 5;
• Embedded Assignment
x = (y = 50) + 10;
• Compound Assignment
x + = 10;
THANK
YOU

More Related Content

PPTX
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
PPTX
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
PPTX
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
PDF
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
PPTX
Functional Programming, simplified
PPT
Python advanced 3.the python std lib by example –data structures
PPT
Python advanced 3.the python std lib by example – algorithm
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
Functional Programming, simplified
Python advanced 3.the python std lib by example –data structures
Python advanced 3.the python std lib by example – algorithm

What's hot (19)

PDF
Core Java Programming Language (JSE) : Chapter V - Arrays
PPTX
Files streams..
PPTX
Array in c language
PDF
Type hints Python 3
PDF
An Introduction to the C++ Standard Library
PPT
Data structures
DOC
Xii Compsc Hw
PPT
Review constdestr
PPTX
Lecture1 classes4
PPTX
constructors in java ppt
PPTX
Templates in c++
PPTX
Array in C
PPT
Constructor & Destructor
PPTX
An Overview of the Java Programming Language
PPT
Oop lec 5-(class objects, constructor & destructor)
PPTX
Understanding the components of standard template library
PPT
Constructor and Destructor PPT
Core Java Programming Language (JSE) : Chapter V - Arrays
Files streams..
Array in c language
Type hints Python 3
An Introduction to the C++ Standard Library
Data structures
Xii Compsc Hw
Review constdestr
Lecture1 classes4
constructors in java ppt
Templates in c++
Array in C
Constructor & Destructor
An Overview of the Java Programming Language
Oop lec 5-(class objects, constructor & destructor)
Understanding the components of standard template library
Constructor and Destructor PPT
Ad

Similar to Operators and expression in c++ (20)

PPTX
Operators
PPT
Beginning with C++.ppt thus us beginnunv w
PPT
C++ - Constructors,Destructors, Operator overloading and Type conversion
PPT
operators and expressions in c++
PDF
Object Oriented Programming Short Notes for Preperation of Exams
PDF
Introduction to C++
PPTX
C++.pptx
PDF
PPT2-C++ NUMERICAL METHOD FOR M.Sc PHYSICS
PPTX
Chapter 2.datatypes and operators
PDF
Data types, operators and control structures unit-2.pdf
PDF
2nd PUC Computer science chapter 5 review of c++
PPT
Operators in C++
PPTX
expression in cpp
PPTX
expression in cpp
PPT
C++ chapter 2
PDF
chap3expression-1603gggh13040831 (1).pdf
PPT
Operators and Expressions in C++
PPT
Pointer
PDF
Chapter 5 - Operators in C++
PPT
Object Oriented Technologies
Operators
Beginning with C++.ppt thus us beginnunv w
C++ - Constructors,Destructors, Operator overloading and Type conversion
operators and expressions in c++
Object Oriented Programming Short Notes for Preperation of Exams
Introduction to C++
C++.pptx
PPT2-C++ NUMERICAL METHOD FOR M.Sc PHYSICS
Chapter 2.datatypes and operators
Data types, operators and control structures unit-2.pdf
2nd PUC Computer science chapter 5 review of c++
Operators in C++
expression in cpp
expression in cpp
C++ chapter 2
chap3expression-1603gggh13040831 (1).pdf
Operators and Expressions in C++
Pointer
Chapter 5 - Operators in C++
Object Oriented Technologies
Ad

More from ThamizhselviKrishnam (11)

PPTX
Standard template library
PPTX
Templates in c++
PPTX
Functions, classes & objects in c++
PPTX
Page maker - working with text
PPTX
Microprocessor & architecture
PPTX
Instruction set of 8085
PPTX
Memory and storage devices
PPTX
Generations of computer
PPTX
Adobe Pagemaker 7.0
PPTX
classification of digital computer
PPTX
Standard template library
Templates in c++
Functions, classes & objects in c++
Page maker - working with text
Microprocessor & architecture
Instruction set of 8085
Memory and storage devices
Generations of computer
Adobe Pagemaker 7.0
classification of digital computer

Recently uploaded (20)

PPTX
2Systematics of Living Organisms t-.pptx
PPTX
Microbiology with diagram medical studies .pptx
PPTX
Cell Membrane: Structure, Composition & Functions
PDF
The scientific heritage No 166 (166) (2025)
PPT
protein biochemistry.ppt for university classes
PDF
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
PPTX
Introduction to Fisheries Biotechnology_Lesson 1.pptx
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PPTX
The KM-GBF monitoring framework – status & key messages.pptx
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PDF
Sciences of Europe No 170 (2025)
PPTX
INTRODUCTION TO EVS | Concept of sustainability
PDF
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
PDF
Placing the Near-Earth Object Impact Probability in Context
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PDF
lecture 2026 of Sjogren's syndrome l .pdf
PPTX
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5
2Systematics of Living Organisms t-.pptx
Microbiology with diagram medical studies .pptx
Cell Membrane: Structure, Composition & Functions
The scientific heritage No 166 (166) (2025)
protein biochemistry.ppt for university classes
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
Phytochemical Investigation of Miliusa longipes.pdf
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
Introduction to Fisheries Biotechnology_Lesson 1.pptx
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
The KM-GBF monitoring framework – status & key messages.pptx
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
Sciences of Europe No 170 (2025)
INTRODUCTION TO EVS | Concept of sustainability
ELS_Q1_Module-11_Formation-of-Rock-Layers_v2.pdf
Placing the Near-Earth Object Impact Probability in Context
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
lecture 2026 of Sjogren's syndrome l .pdf
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5

Operators and expression in c++

  • 1. OPERATORS IN C++ K.THAMIZHSELVI Asst. Prof. of Computer Science Bon Secours College for Women, Thanjavur
  • 2. Other New Operators • Scope Resolution Operator (::) • Pointer to member Declarator (::*) • Pointer to Member Operator (-> , .*) • Memory release Operator (delete) • Memory Allocation Operator (new) • Line feed Operator (endl) • Field width Operator (setw)
  • 3. Scope Resolution Operator :: variable name Global variable can be access from within the inner block using Scope resolution operator.
  • 4. Member Dereferencing Operators • C++ allow to define class of different data types and functions. • Also permit to access class member through pointers. • 3 types: – Pointer to member Declarator (::*) – Pointer to Member Operator (-> , .*)
  • 5. Memory Management Operators • Unary operators new and delete • Alice known as free store operators. • An object created by new and destroyed by delete. • GF: Pointer variable = new data type; Pointer variable = new data type(value); Pointer variable = new data type[size]; a = new int; int *p = new int; (or) *p = 25; Int *p = new int (25); Int *p = new int [10];
  • 6. • Delete: When the data object is not needed, it is destroyed by using delete operator to free up the memory space. GF: delete pointer variable; delete [size] pointer variable; delete p; delete [] p;
  • 7. Manipulators • endl – output statement – new line character • setw – to display in right justification – specify the width • Eg: cout<< setw(5) <<sum <<endl; 3 4 5
  • 8. EXPRESSIONS • Combination of operators, constants and variables. • 7 types: – Constant expression – Integer expression – Float expression – Pointer expression – Relational expression – Logical expression – Bitwise expression
  • 9. SPECIAL ASSIGNMENT EXPRESSION • Chained Assignment x = y = 5; • Embedded Assignment x = (y = 50) + 10; • Compound Assignment x + = 10;