What do you mean by inline function?

by jack| Views: 864

What do you mean by inline function?



Tags:  Oops Interview

Answers (2)
 
Rohita Said..

The idea behind inline functions is to insert the code of a called function at the point where the function is called. If done carefully, this can improve the application's performance in exchange for increased compile time and possibly (but not always) an increase in the size of the generated binary executables.

Thanks



hetali Said..

When we use inline function we first declare the keyword(INLINE).Then we declare its datatype then write or pass any arguments.we also assign the value.It cant take any complexity then it's execution speed is fast.

ADVANTAGES:
*when we create any program and if their is a some activity or criteria is occur more then one time then it is very useful.
*It is very easy to use in program.

DISADVANTAGES:
*In this function we never create any complexity.like we never use compound statement,for loop,goto statement,static variables,switch case.
so that time it cant helpful.


*If we create any complexity then it cant understand that condition & it saw us to not any error but it declare us to warning that we cant use to or create complexity. That time Inline function is treat in simple UDF.

EXAMPLE:
#include
#include

Inline int cube(int l)
{
return l*l*l;
}
void main()
{
clrscr();
int a=10;
int c=cube(a);
cout<<"The answer is c:";
getch();
}



Register or Login to Post Your Opinion/Answer