Inline Function in C++

An inline function is a function that is expanded in line when it is invoked, the compiler replaces the function call with the corresponding function code. It has the following syntax :

inline function-header
 functions of the body

Example :
inline float square (float a)

Program :

using namespace std;
inline float add(float a, float b)
inline double sub(double c, double d)
int main()
 float x=15.7567;
 float y=12.56;
return 0;

Recommended Posts:

    1. Concepts of OOP
    2. C++ input output functions
    3. Data Types in C++
    4. Operators in C++
    5. C++ Control Statements | if-else, switch, for, while and do-while
    6. Call by Value and Call by Reference in C++
    7. Inline Function in C++
    8. Default Arguments in C++
    9. Function Overloading in C++
    10. C++ Program to Find Factorial of Number
    11. C++ Program to Solve Tower of Hanoi using Recursion