#include <iostream>
using namespace std;
//this function is the fastest bacause it executes at compile time and is really fast ,
//but dont use it for like a big function
inline int cube(int s)
{
return s*s*s;
}
int main()
{
cout << "The cube of 3 is: " << cube(3) << "
";
return 0;
} //Output: The cube of 3 is: 27
A function specifier that indicates to the compiler that inline substitution
of the function body is to be preferred to the usual function call
implementation
inline <return_type> <function_name>(<parameters>)
{
// function code
}
SOURCE - geeksforgeeks
Code Example |
---|
Cpp :: hello world in c/++ |
Cpp :: insert a character into a string c++ |
Cpp :: remove space in string c++ |
Cpp :: how to convert ascii to char in cpp |
Cpp :: bee 1002 solution |
Cpp :: c++ progress bar |
Cpp :: hexadecimal or binary to int c++ |
Cpp :: json::iterator c++ |
Cpp :: c++ filesystem read directory |
Cpp :: Find minimum maximum element CPP |
Cpp :: how to split string into words c++ |
Cpp :: how to calculate bitwise xor c++ |
Cpp :: compute power of number |
Cpp :: error handling in c++ |
Cpp :: ascii cpp |
Cpp :: check if element in dict c++ |
Cpp :: show stack c++ |
Cpp :: cin exceptions c++ |
Cpp :: how to remove maximum number of characters in c++ cin,ignore |
Cpp :: cpp #include "" < |
Cpp :: map count function c++ |
Cpp :: accumulate vector c++ |
Cpp :: data types in c++ |
Cpp :: linux c++ sigint handler |
Cpp :: Translation codeforces in c++ |
Cpp :: heredar constructor c++ |
Cpp :: how to make loop in c++ |
Cpp :: c++ formatting |
Cpp :: c++ prime number |
Cpp :: statements |