Interview Questions   Tutorials   Discussions   Programs   Videos   

C++ - What do you mean by inline function?

asked marvit August 18, 2014 12:51 PM  

What do you mean by inline function?


1 Answers

answered By bhjahnavi   0  
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.
an example for inline function is given below 
/*an example program to demonstrate inline functions*/
#include <iostream>
using namespace std;

inline int Max(int x, int y)
  return (x > y)? x : y;

// Main function for the program
int main( )

  cout << "Max (20,10): " << Max(20,10) << endl;
  cout << "Max (0,200): " << Max(0,200) << endl;
  cout << "Max (100,1010): " << Max(100,1010) << endl;
  return 0;
   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!