Inline Function- Program And Its Uses

inline function
inline function

Inline Function:-

The function that is declared with the help of keyword ‘inline’ is known as Inline Function.

It is a function that will expand inline at each point in a program where it is invoked. Also we can say that function body is inserted at the place of function calling whenever the compiler compiles the program so that compiler do not have to go at function definition again and again for each function call.

Like this overheads of compiler will reduced and execution time improves.

Whenever a function is called the following task will be performed,

  1. Storing the memory address of instructions that are used.
  2. The different type of values will be saved in registers.
  3. Actual arguments are pushed or inserted  onto the stack.
  4. Arguments of called function will be popped or deleted from the stack.

 

Syntax,

inline  <returntype> <functionname>(parameters)

{

Fuction Body

}

Program,

#include<iostream.h>

#include<conio.h>

inline int maximum(int x, int y)

{

return (x>y? x: y);

}

void main ()

{

clrscr();

int m= 11, n= 25;

int a, b;

a= maximum(16, 18);

cout<<” Maximum of 16 and 18 is:- “<<a;

b= maximum(m, n);

cout<<” \nMaximum of “<<m<<” and ”<<n<<” is:-“<<b;

}

Output:-

Maximum  of  16  and 18 is:-1 8

Maximum of  11  and  25 is:- 25

You Also Can Visit For More Knowledge In C++:-

Visit Your YouTube  Channel:-  Think , About It

Visit Your Website :- www.atozlives.com

Thanks,

“Play With All Computer Science , Mathematics  And Technology.”

 

 

22 COMMENTS

  1. Asking questions are truly fastidious thing if you are not understanding anything entirely, however this post offers good understanding even. Gertrud Patsy Anastas Madella Dew Grae

  2. Thanks for your handy post. As time passes, I have come to understand that the actual symptoms of mesothelioma are caused by the particular build up of fluid regarding the lining of your lung and the chest muscles cavity. The sickness may start in the chest area and pass on to other limbs. Other symptoms of pleural mesothelioma cancer include fat loss, severe inhaling and exhaling trouble, temperature, difficulty swallowing, and swelling of the neck and face areas. It really should be noted that some people having the disease tend not to experience almost any serious signs or symptoms at all. Friederike Mandel Almena

  3. I believe this is one of the so much significant information for me. And i am happy reading your article. But want to observation on few general things, The website style is great, the articles is truly nice : D. Good job, cheers Nan Scarface Pollie

  4. Hi there. I discovered your web site by means of Google at the same time as searching for a similar subject, your website got here up. It appears good. I have bookmarked it in my google bookmarks to visit then. Perrine Meredith Triley

  5. Somebody essentially help to make seriously posts I would state. This is the very first time I frequented your website page and thus far? I surprised with the research you made to make this particular publish incredible. Excellent job! Nola Cross Ahl

  6. Whenever I start to read some content page I have a feeling that it is time consuming and nothing will bring me. But what about you so I was very pleasantly surprised. You are super having very valuable content and posobite very trustworthy. Keep your reputation for the future. Good luck and have a nice day. Thank you for supplying these details. This article provided by you is very useful stuff. Cool, what a website it is! Toma Lenard Flight

  7. Hello there, I do believe your site could be having web browser compatibility issues. When I take a look at your website in Safari, it looks fine but when opening in IE, it has some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, fantastic blog! Eleonora Kahaleel Marquita

LEAVE A REPLY

Please enter your comment!
Please enter your name here