Inline Function

Inline function in c++ is a function for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. Inline function is an enhancement feature that improves the execution time and speed of the program.

CODE

EG 1 . Creating an inline function called cube.

#include <iostream>
using namespace std;

inline int cube(int number){
    return number*number*number;
}

int main() {
    int result = cube(3);
    cout << result << endl;
}



(Click Here, For more exercises)