Inline function in C++ by R4R Team

-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;
}


output-

20
200




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!