Inline functions, C/C++ Programming

Inline functions, C++ provides inline functions to help reduce function_call overhead especially for small functions. The

qualifier inline before function's return type in the function informs the computer to generate a copy of the functions code in place, to avoid a function call.

The disadvantage is that multiple copies of function code are inserted in the program (thus making it larger) rather than a single copy of the function to which control is passed each time the function is called.
The compiler can ignore the inline qualifier especially for large functions


Write a C++ program that prompts for the radius of a circle, and which is passed to an inline function to compute and return the area of a circle. Your program then displays the computed value.


using namespace std;

inline double computearea(int);
int main()


int radius; 

double area;

cout<<"Enter the radius of the circle"<>radius;


cout<<"The area of the circle is:"

<return  0;


double computearea(int r)

const float    PI=3.142;
return PI*pow(r,2);

Posted Date: 8/21/2012 11:50:25 AM | Location : United States

Related Discussions:- Inline functions, Assignment Help, Ask Question on Inline functions, Get Answer, Expert's Help, Inline functions Discussions

Write discussion on Inline functions
Your posts are moderated
Related Questions
A body which has three forces acting on it is in equilibrium. One force is 3N to the North and the other is 4N to the west. What us the magnitude and direction of the third force?

A: This is a name that acts as an alias, or alternative name, for a beforehand defined variable or an object. prepending variable along with "&" symbol makes it as reference. fo

What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than a

SquareMaze The SquareMaze class should be declared and defined in maze.h and maze.cpp, respectively. Each SquareMaze object will represent a randomly-generated square maze and its

Overloading Unary Operators class sign {int a,b,c; public: sign(){}; sign(int,int,int); void putdata(void); void operator-(); }; void sign::operator-() {a=

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

write c++ program to decode the given code. in mobile keypad the integers from 1 to 9 will display the characters from a to z and 0 will assign a space

C program to Print Fibonacci series upto n using recursion: int fibo(long int); void main() {                 long int a=0,n;                 printf ("how many term

Create a program doing the following:  For each word in the le word.txt { Create an object of the class Word { Add the object to a set of the type java.uti

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst. Shortest remaining time rst algori