This material aims to enable students to:
1) Understand and practice modular programming concept
2) Implement for use of function and procedure
3) Determine when to use function and procedure
4) Implement subprogram call from the main program
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Algorithm and Data Structure - Modular Programming
1. Algorithm and
Data Structure
Andi Nurkholis, S.Kom, M.Kom
Study Program of Informatics
Faculty of Engineering and Computer Science
SY. 2020-2021
March 22, 2021
3. 3
Modular Programming
Modular programming allows the program designer
to simplify problems within the program by breaking
down or dividing the problem into smaller sub-
problems in order to be easily solved
5. 5
Benefit of
Modular
Programming
1) Reduces development time
2) Improves reliability
3) Increases standardization of the
software development process
4) Simplifies modifications
6. 6
Variable
Variable is a name that represents a data element. Variable is also
a temporary storage place for data in memory whose contents can
change
Variables consist of two types, namely local and global variable
7. 7
Local Variable
Local variable is a variable declared in a function or procedure.
This variable can only be recognized within the function or
procedure itself. Local variables cannot be called, accessed and
changed by other procedures or functions, even by the main
program
8. 8
Global Variable
Global variable is a variable that is defined in the main program
and can be used in the main program or other sub-programs. The
value of this variable can be called, accessed and changed by any
procedure or function contained in the program
9. 9
What is Function?
Function is a subprogram that receives input data,
performs several processes, returns output values
for use by the process that calls the function
The function is also often called non-void functions.
Called non-void because it returns value that comes
from the output of the function
12. What is Procedure?
Procedure is a series of instructions named, and performs a
specific purpose. As with functions, procedures work with a call-
return mechanism
The procedure is also often referred to as void function. Called
void because the function does not return an output value
obtained from the results of the function's process
12
13. Characteristics
of Procedure
1) Does not have keyword return
2) Does not have a data type in the
function declaration
3) Use the void keyword
4) Cannot immediately display the results
5) Has no function return value
13
15. What is Unit?
Unit is a library that is generally in the form of
procedures or functions
The difference between unit and preprocessor
directive is that the unit is a library developed by
user while directive preprocessor is a standard
library that has been provided by C
15
17. Thank You, Next …
Stack
March 22, 2021
Andi Nurkholis, S.Kom, M.Kom
Study Program of Informatics
Faculty of Engineering and Computer Science
SY. 2020-2021