Save
COMP 002 - Computer Programming 1
003 - FUNCTIONS
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Visit profile
Cards (17)
Functions
A group of statements that perform a task.
THREE ELEMENTS OF FUNCTION
Function Prototype
(
Declaration
)
Function Definition
Function Call
Function Prototype
/
Declaration
An element of a function that tells the compiler about a function's name, return type, and parameters. (how to call the function)
Function Definition
Provides the actual body of the function.
A function can also be referred as a
method
or a
sub-routine
or a
procedure.
Return Type
The data type of the value the function returns.
Return Type
A function may return a value.
A function definition in C programming consists of a
function header
and a
function
body.
Function Name
This is the actual name of the function.
Parameter
Also known as a
placeholder
.
Parameter List
Refers to the type, order, and number of the parameters of a function.
Function Body
Contains a collection of statements that define what the function does.
Function Call
Function Execution in the
main program
.
TWO TYPES OF FUNCTION BY DEFINITION
Built-In Function
/
Pre-defined Function
User-Defined Function
Built-In Function
/
Pre-defined Function
Functions that are already provided by the C programming language itself or by standard libraries.
User-Defined Function
Defined by the user himself to perform some specific tasks.
FUNCTION ARGUMENTS
Formal Parameters
Call Parameters