-C++ inline function is powerful concept that is commonly used with classes.
-If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.
Which keyword is use to make function as inline?
inline keyword
program:
#include< iostream>
using namespace std;
//make inline function
inline int max(int x, int y) {
return (x > y)? x : y;
}
// Main function for the program
int main() {
cout << max(10,20)<< endl;
cout << max(0,200) << endl;
return 0;
}
20
200