SPC - Module Iv - I
SPC - Module Iv - I
Library functions
❖ Library functions are those functions which are already defined in C library
❖ Example: printf(), scanf(), strcat() etc.
❖ You just need to include appropriate header files to use these functions
User-defined functions:
❖ User Defined Functions are those functions which are defined by the user at the time of writing
program
❖ These functions are made for code reusability and for saving time and space
HOW FUNCTION WORKS
Function Function
Declaration Definition
Function Call
Actual arguments:
The values that are passed to the called function from the
main function are known as Actual arguments
Formal arguments:
The variables declared in the function prototype or
definition are known as Formal arguments
PARAMETER (ARGUMENT) PASSING
❖ The value of the actual parameters is copied into the formal parameters
❖ The arguments in the function call (Actual arguments) are not modified by the change
in parameters of the called function (Formal arguments)
❖ Different memory is allocated for actual and formal parameters
a b a b
Actual Argument 10 20 10 20 Formal Argument
❖ The address of the variable is passed into the function call as the actual parameter
❖ The value of the actual parameters can be modified by changing the formal parameters since
the address of the actual parameters is passed
❖ Same memory is allocated for both formal parameters and actual parameters
a a
Actual Argument 10 100 Formal Argument
100 200
Normal Variable Pointer that stores the address
of actual argument
CALL BY REFERENCE