CE144 OOPC Unit-04
CE144 OOPC Unit-04
UNIT-4
Functions
N. A. Shaikh
[email protected]
Topics to be covered
The main function
Simple functions
Call by reference
return by reference
Inline functions
Overloaded functions
Default arguments
NOTE:
Try above program in C and C++. Notice the difference
Example:
Function Calling
Function Definition
Syntax:
Rectifying the error: We can simply tell the compiler that the literal is a float
and NOT double by providing suffix f.
NOTE:
• Include header file math.h
/ cmath
• X and y are of type double
• All function return data
type double
Unit 4: Functions Prepared By: Nishat Shaikh
45
End of Unit-4