#1 2008-01-18 19:40:31

Fuad
Member
RankingRankingRanking
Registered: 2008-01-09
Posts: 98
Expertise

In-Line Functions in C++

In C++, it is possible to define functions that are not actually called but, rather are expanded inline, at the point of each call. The advantage of inline functions is that they have no overhead associated with the function call and return mechanism. That means inline functions can be executed much faster than normal functions.

Example:

Code::

inline void sum()
{
  int i,sum=0;
  for(i=0;i<10;i++)
  sum=sum+i;
  cout<<sum;
}

Offline

 

Board footer

OPML feedsRSS feeds



Powered by WWWThreads Forum
© Copyright 2006, WWWThreads