Mega Code Archive

 
Categories / C++ Tutorial / Function
 

Inline functions work best on short functions that are used repeatedly This example calculates the square of an integer

#include <iostream> using namespace std; inline long squareit(int iValue) {return iValue * iValue;}                                 int main() {  int iValue = 5;  cout << squareit(iValue) << endl;  return (0); }