Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

inline function in c++

#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
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #inline #function
ADD COMMENT
Topic
Name
2+9 =