Professional Documents
Culture Documents
Chapter 6 - I
Chapter 6 - I
Problem Solving
(CSC415)
by
PUAN AFIZA ISMAIL
Faculty of Computer & Mathematical Sciences
UiTM MALAYSIA
1
Function I
Chapter 6
2
Contents
6.1 Introduction
6.2 Function and parameter declaration
- Predefined function
- User-defined function
- Function prototype
- Flow of execution
Called modules
sqrt(x)
pow(x,y)
floor(x)
Pre-defined function :
pow(x,y) :
Pre-defined function :
floor(48.79) is 48.0
User-defined function :
formal parameter : a variable declared in the
function heading; can be empty
functionType functionName()
functionName()
December 2, 2023 CSC425 : INTRODUCTION TO COMPUTER 15
PROGRAMMING
6.2
Function and parameter declaration
(cont.)
User-defined function :
return statement :
Once the function computes the value, the function
returns the value via the return statement
The syntax of the return statement is: