
Chapter 3: Function Oriented Programming
1
Lecturer: PhD. DO Thi Ngoc Diep
SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING
HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY

2
Content
•3.1. Function Oriented Programming Concept
•3.2. Function concept
•3.3. Function calling
•3.4. Function Oriented Programming in C
•3.4.1. Function prototype
•3.4.2. Parameters specification
•3.4.3. Return type specification
•3.4.4. Global and local variables
•3.4.5. Function Pointers
•3.5. Some extensions

3
3.1. Function Oriented Programming concept
•Function-oriented programming method (or structured
programming) is a method that allows to divide a program
function (parent function) into smaller functions (called child
functions).
•can be repeated for the sub-functions, until the functions are small
enough and need not to be divided any more (then they are called prime
functions).
•Example
Solve the quadratic equation
Enter the coefficients Calculate delta Calculate the solution

4
3.1. Function Oriented Programming concept
•Data connection between functions
parent function
child function
Input data Output data
data
without
content
data with
content
Enter the coefficients Calculate delta Calculate the solution
Solve the quadratic equation

5
3.2. Concept of function
•Function: a block of statements that perform a certain task, and
can be called as needed
•Cons:
•Break down the program into many sub problems
•Reuse one or more times in one or more programs/projects
•Each function has to be defined before being used
•A name
•A number of parameters/arguments (can be empty)
•A returned value type
•Corresponding block of statements

