SlideShare a Scribd company logo
C++ Function
Liao Ping-Lun
Agenda
 Function Prototype
 Function Definition
 Function Call
 Function Overloading
 Function Pointer & Callback Function
 Function Template
© 2000 Prentice Hall, Inc. All rights reserved.
Basics of a Typical C++ Environment
Phases of C++ Programs:
1. Edit
2. Preprocess
3. Compile
4. Link
5. Load
6. Execute
Loader
Primary
Memory
Program is created in
the editor and stored
on disk.
Preprocessor program
processes the code.
Loader puts program
in memory.
CPU takes each
instruction and
executes it, possibly
storing new data
values as the program
executes.
Compiler
Compiler creates
object code and stores
it on disk.
Linker links the object
code with the libraries,
creates a.out and
stores it on disk
Editor
Preprocessor
Linker
CPU
Primary
Memory
.
.
.
.
.
.
.
.
.
.
.
.
Disk
Disk
Disk
Disk
Disk
Function Prototype
 return_type function_Name( paramet
er type list );
 Example
 int sum( int a, int b);
 double minus( double a, double b);
Function Definition
return_type function_name( parameter list)
{
declarations
statements
}
 Example
 int sum( int a, int b ) { return a + b; }
 double minus( double a, double b ) { ret
urn a – b; }
Function Call
 Example
 sum( 3, 5);
 minus( 5.5, 6.6 );
Function Overloading
 Parameter list
 Ex:
 int max(int, int);
 float max(int, int);
 Overload Resolution
 Overload.cpp
Function Pointer
 Example
 f(x) = x2
 f(x) = x3
 …..
 FunctionPointer.cpp
 What else?
∑ )(xf
Callback Function
Callback Function
The Window Procedure callback
Function template
 Algorithm-based Functions.
 FunctionTemplate.cpp
References
 A Book on C, 4ed, Al Kelley, Ira Pohl
 C: How to Program, 3rd, Deitel & Deit
el

More Related Content

What's hot (20)

PPTX
Function C++
Shahzad Afridi
 
PPTX
functions of C++
tarandeep_kaur
 
PPT
Functions in C++
Mohammed Sikander
 
PPTX
C and C++ functions
kavitha muneeshwaran
 
PPTX
Inline function
Tech_MX
 
PPT
Lecture#6 functions in c++
NUST Stuff
 
PPTX
Built in function
MD. Rayhanul Islam Sayket
 
PPT
C++ functions
Dawood Jutt
 
PPTX
Parameter passing to_functions_in_c
ForwardBlog Enewzletter
 
PPT
Functions in C++
Sachin Sharma
 
PPTX
Function overloading
Selvin Josy Bai Somu
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PPTX
Learning C++ - Functions in C++ 3
Ali Aminian
 
PPTX
Function in c++
Kumar
 
PPT
C++ Function
Hajar
 
PPTX
Call by value
Dharani G
 
PPT
C++ functions
Mayank Jain
 
PPT
C++ functions presentation by DHEERAJ KATARIA
Dheeraj Kataria
 
ODP
Function
jayesh30sikchi
 
PPT
C++ Functions
sathish sak
 
Function C++
Shahzad Afridi
 
functions of C++
tarandeep_kaur
 
Functions in C++
Mohammed Sikander
 
C and C++ functions
kavitha muneeshwaran
 
Inline function
Tech_MX
 
Lecture#6 functions in c++
NUST Stuff
 
Built in function
MD. Rayhanul Islam Sayket
 
C++ functions
Dawood Jutt
 
Parameter passing to_functions_in_c
ForwardBlog Enewzletter
 
Functions in C++
Sachin Sharma
 
Function overloading
Selvin Josy Bai Somu
 
Functions in c++
Rokonuzzaman Rony
 
Learning C++ - Functions in C++ 3
Ali Aminian
 
Function in c++
Kumar
 
C++ Function
Hajar
 
Call by value
Dharani G
 
C++ functions
Mayank Jain
 
C++ functions presentation by DHEERAJ KATARIA
Dheeraj Kataria
 
Function
jayesh30sikchi
 
C++ Functions
sathish sak
 

Viewers also liked (20)

PPTX
Functions in C++
home
 
PDF
Data types
Learn By Watch
 
PPTX
Lecture 03 Software Risk Management
Achmad Solichin
 
PPTX
Characteristics of Software
Upekha Vandebona
 
PPTX
Need for Software Engineering
Upekha Vandebona
 
PPT
C++ Language
Syed Zaid Irshad
 
PPTX
Dbms and sqlpptx
thesupermanreturns
 
PPT
Operating system services 9
myrajendra
 
PPTX
Inline function in C++
Learn By Watch
 
PDF
C++ OOPS Concept
Boopathi K
 
PPT
Functions
Online
 
PPT
C++ functions
Dawood Jutt
 
PPTX
C++ programming (Array)
طارق بالحارث
 
PPTX
Entity Relationship Model
Slideshare
 
PPTX
Array in c++
Mahesha Mano
 
PPTX
Oop c++class(final).ppt
Alok Kumar
 
PDF
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
PPT
friend function(c++)
Ritika Sharma
 
PPTX
C++ programming function
Vishalini Mugunen
 
PPT
02 c++ Array Pointer
Tareq Hasan
 
Functions in C++
home
 
Data types
Learn By Watch
 
Lecture 03 Software Risk Management
Achmad Solichin
 
Characteristics of Software
Upekha Vandebona
 
Need for Software Engineering
Upekha Vandebona
 
C++ Language
Syed Zaid Irshad
 
Dbms and sqlpptx
thesupermanreturns
 
Operating system services 9
myrajendra
 
Inline function in C++
Learn By Watch
 
C++ OOPS Concept
Boopathi K
 
Functions
Online
 
C++ functions
Dawood Jutt
 
C++ programming (Array)
طارق بالحارث
 
Entity Relationship Model
Slideshare
 
Array in c++
Mahesha Mano
 
Oop c++class(final).ppt
Alok Kumar
 
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
friend function(c++)
Ritika Sharma
 
C++ programming function
Vishalini Mugunen
 
02 c++ Array Pointer
Tareq Hasan
 
Ad

Similar to C++ Function (20)

PPT
C++ Functions.ppt
WaheedAnwar20
 
PPTX
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
PDF
Chap 5 c++
Venkateswarlu Vuggam
 
PPT
Chapter 1.ppt
ethiouniverse
 
PPT
Chap 5 c++
Venkateswarlu Vuggam
 
PDF
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
jacobdiriba
 
PPTX
C++ Functions.pptx
DikshaDani5
 
PPT
chapterintroductiontomodularprogramming-230112092330-e3eb5a74 (1).ppt
harinipradeep15
 
PPT
Chapter Introduction to Modular Programming.ppt
AmanuelZewdie4
 
PPTX
Chapter One Function.pptx
miki304759
 
PPTX
Silde of the cse fundamentals a deep analysis
Rayhan331
 
DOCX
Chapter 5
Amrit Kaur
 
PPT
POLITEKNIK MALAYSIA
Aiman Hud
 
PPTX
Chapter 4
temkin abdlkader
 
PPTX
Chp8_C++_Functions_Part2_User-defined functions.pptx
ssuser10ed71
 
DOC
Functions
zeeshan841
 
PPTX
FUNCTIONS, CLASSES AND OBJECTS.pptx
DeepasCSE
 
PDF
Functions in C++.pdf
LadallaRajKumar
 
PPTX
User defined function in C.pptx
Rhishav Poudyal
 
PPTX
6. Functions in C ++ programming object oriented programming
Ahmad177077
 
C++ Functions.ppt
WaheedAnwar20
 
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
Chapter 1.ppt
ethiouniverse
 
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
jacobdiriba
 
C++ Functions.pptx
DikshaDani5
 
chapterintroductiontomodularprogramming-230112092330-e3eb5a74 (1).ppt
harinipradeep15
 
Chapter Introduction to Modular Programming.ppt
AmanuelZewdie4
 
Chapter One Function.pptx
miki304759
 
Silde of the cse fundamentals a deep analysis
Rayhan331
 
Chapter 5
Amrit Kaur
 
POLITEKNIK MALAYSIA
Aiman Hud
 
Chapter 4
temkin abdlkader
 
Chp8_C++_Functions_Part2_User-defined functions.pptx
ssuser10ed71
 
Functions
zeeshan841
 
FUNCTIONS, CLASSES AND OBJECTS.pptx
DeepasCSE
 
Functions in C++.pdf
LadallaRajKumar
 
User defined function in C.pptx
Rhishav Poudyal
 
6. Functions in C ++ programming object oriented programming
Ahmad177077
 
Ad

More from PingLun Liao (20)

PDF
深入探討 C 語言
PingLun Liao
 
ODP
Git 程式碼版本控制軟體介紹
PingLun Liao
 
PDF
給沒有程式設計經驗的人
PingLun Liao
 
PDF
陣列與指標
PingLun Liao
 
PPT
Perl For Bioinformatics
PingLun Liao
 
ODP
C++ STL 概觀
PingLun Liao
 
ODP
C 檔案輸入與輸出
PingLun Liao
 
ODP
Win32 視窗程式設計基礎
PingLun Liao
 
ODP
Matlab 在機率與統計的應用
PingLun Liao
 
ODP
Android 2D 遊戲設計基礎
PingLun Liao
 
ODP
Android 介面設計
PingLun Liao
 
ODP
Java 視窗程式設計
PingLun Liao
 
ODP
Java 網路程式
PingLun Liao
 
ODP
Android introduction
PingLun Liao
 
ODP
RESTful
PingLun Liao
 
ODP
Web service
PingLun Liao
 
ODP
How toprogram
PingLun Liao
 
ODP
Generic Programming
PingLun Liao
 
ODP
Object-Oriented Programming
PingLun Liao
 
ODP
Object-Based Programming Part II
PingLun Liao
 
深入探討 C 語言
PingLun Liao
 
Git 程式碼版本控制軟體介紹
PingLun Liao
 
給沒有程式設計經驗的人
PingLun Liao
 
陣列與指標
PingLun Liao
 
Perl For Bioinformatics
PingLun Liao
 
C++ STL 概觀
PingLun Liao
 
C 檔案輸入與輸出
PingLun Liao
 
Win32 視窗程式設計基礎
PingLun Liao
 
Matlab 在機率與統計的應用
PingLun Liao
 
Android 2D 遊戲設計基礎
PingLun Liao
 
Android 介面設計
PingLun Liao
 
Java 視窗程式設計
PingLun Liao
 
Java 網路程式
PingLun Liao
 
Android introduction
PingLun Liao
 
RESTful
PingLun Liao
 
Web service
PingLun Liao
 
How toprogram
PingLun Liao
 
Generic Programming
PingLun Liao
 
Object-Oriented Programming
PingLun Liao
 
Object-Based Programming Part II
PingLun Liao
 

Recently uploaded (20)

PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
The Future of Artificial Intelligence (AI)
Mukul
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 

C++ Function