Cs112 - Programming Fundamental: Lecture # 36 - Function in C Syed Shahrooz Shamim
Cs112 - Programming Fundamental: Lecture # 36 - Function in C Syed Shahrooz Shamim
Lecture # 36 – Function in C
Syed Shahrooz Shamim
Junior Lecturer,
CS Department, UIT
Definition
• A set of statements working together with
common goal is known as function.
• Library functions
• User-Defined functions
Library functions
These are also known as Pre defined functions.
Ex.
• Function declaration
• Function Call
• Function definition
Function Declaration
Syntax:
Ex.
int add(int , int);
Function call
The program that calls the function is referred to as
the calling program or calling functions
Syntax:
function_name(actual parameters);
Ex.
add(a,b);
Function definition
• The function definition is an independent program
module that is specially written or implement the
requirements of the function.
main()
{
function1();
….
function2();
}
function1()
{
…
}
function2()
{
…
function1();
}
Types of functions
1) Function with no arguments & no return value.