SlideShare a Scribd company logo
1 of 8
Functions in C++
Introduction
Importance of Functions
Advantages of Function
Functions:
A function is a named block of code that
performs some action. The statement
written in a function is executed when it is
called by its named. Each function has a
unique name. Function is the building
blocks of C++ programs. They
encapsulate pieces of code to performed
specified operation.
Importance of function:
A program may need to repeat the same
piece of code at various places. It may be
required to perform certain tasks
repeatedly. The program may become
very large if functions are not used. The
piece of code that is executed repeatedly
is stored in a separate function. The real
reason of using functions is to divide a
program into different parts. These parts of
a program can be managed easily.
Advantages of function:
Easier to Code: A lengthy program can be
divided into small function. It is easier to
write small function instead of writing one
long program. A function is written to solve
a particular program. A programmer can
focus attention on a specific problem. It
makes programming easier.
Easier to Modify:
Each function has a unique name and is
written as an independent block. If there is
any error in the program the change is
made to particular function in which error
exists. A small function is easier to modify
than a large program.
Easier to maintain:
Function is easier to maintain than long
programs. Each function contains
independent code. A change in the
function does not affect other parts of
program.
Reusability:
The code written in functions can be reused
as and when required. A function but can
be executed many times. A function is
written to solve a particular problem.
Whenever that problem has to be solved
the function can be executed.
Less Programming
Time:
A program may consist of many functions.
These functions are written as
independent programs. Different
programmers can work on different
functions at the same time it takes far less
time to complete the program.

More Related Content

What's hot

What's hot (7)

Hackjam React London
Hackjam React LondonHackjam React London
Hackjam React London
 
Mobile sdk feb_2015
Mobile sdk feb_2015Mobile sdk feb_2015
Mobile sdk feb_2015
 
Mengenal Software Development Life Cycle - Gilang Ramadhan
Mengenal Software Development Life Cycle - Gilang RamadhanMengenal Software Development Life Cycle - Gilang Ramadhan
Mengenal Software Development Life Cycle - Gilang Ramadhan
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
 
compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
 

Similar to Function in C++

Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
ssuserf86fba
 
function in c programming.pptx
function in c programming.pptxfunction in c programming.pptx
function in c programming.pptx
optimuspc05
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
abex98
 
Oosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction partOosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction part
ManuSingh669370
 

Similar to Function in C++ (20)

Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
function in c programming.pptx
function in c programming.pptxfunction in c programming.pptx
function in c programming.pptx
 
C programming
C programmingC programming
C programming
 
Functions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptxFunctions in python What are functions. Types of functions.pptx
Functions in python What are functions. Types of functions.pptx
 
C- language Lecture 4
C- language Lecture 4C- language Lecture 4
C- language Lecture 4
 
Intoduction to c language
Intoduction to c languageIntoduction to c language
Intoduction to c language
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
DS functions-1.pptx
DS functions-1.pptxDS functions-1.pptx
DS functions-1.pptx
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
presentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C languagepresentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C language
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
 
inline function
inline functioninline function
inline function
 
Oosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction partOosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction part
 
Algorithm-Introduction ,Characterestics & Control Structures.pdf
Algorithm-Introduction ,Characterestics & Control Structures.pdfAlgorithm-Introduction ,Characterestics & Control Structures.pdf
Algorithm-Introduction ,Characterestics & Control Structures.pdf
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
PCCF-UNIT 2-1 new.docx
PCCF-UNIT 2-1 new.docxPCCF-UNIT 2-1 new.docx
PCCF-UNIT 2-1 new.docx
 
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
 

More from NainaKhan28 (7)

C++ constructors
C++ constructorsC++ constructors
C++ constructors
 
creating objects and Class methods
creating objects and Class methodscreating objects and Class methods
creating objects and Class methods
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
Computer network
Computer networkComputer network
Computer network
 
Computational technique
Computational techniqueComputational technique
Computational technique
 
Software Development Life Cycle Model
Software Development  Life  Cycle  ModelSoftware Development  Life  Cycle  Model
Software Development Life Cycle Model
 
Data Communication
Data CommunicationData Communication
Data Communication
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Function in C++

  • 1. Functions in C++ Introduction Importance of Functions Advantages of Function
  • 2. Functions: A function is a named block of code that performs some action. The statement written in a function is executed when it is called by its named. Each function has a unique name. Function is the building blocks of C++ programs. They encapsulate pieces of code to performed specified operation.
  • 3. Importance of function: A program may need to repeat the same piece of code at various places. It may be required to perform certain tasks repeatedly. The program may become very large if functions are not used. The piece of code that is executed repeatedly is stored in a separate function. The real reason of using functions is to divide a program into different parts. These parts of a program can be managed easily.
  • 4. Advantages of function: Easier to Code: A lengthy program can be divided into small function. It is easier to write small function instead of writing one long program. A function is written to solve a particular program. A programmer can focus attention on a specific problem. It makes programming easier.
  • 5. Easier to Modify: Each function has a unique name and is written as an independent block. If there is any error in the program the change is made to particular function in which error exists. A small function is easier to modify than a large program.
  • 6. Easier to maintain: Function is easier to maintain than long programs. Each function contains independent code. A change in the function does not affect other parts of program.
  • 7. Reusability: The code written in functions can be reused as and when required. A function but can be executed many times. A function is written to solve a particular problem. Whenever that problem has to be solved the function can be executed.
  • 8. Less Programming Time: A program may consist of many functions. These functions are written as independent programs. Different programmers can work on different functions at the same time it takes far less time to complete the program.