what is inline function?

Answers were Sorted based on User's Feedback



what is inline function?..

Answer / vishnu

Inline fuction is one which has one line of defination.
If function definiation is more than two lines of
defination it will be treated as normal fuction.
since it will be replaced at compile time it is good to use
inline function if your code is of one line

Is This Answer Correct ?    4 Yes 0 No

what is inline function?..

Answer / anoop raj

The point of making a function inline is to hint to the
compiler that it is worth making some form of extra effort
to call the function faster than it would otherwise -
generally by substituting the code of the function into its
caller. As well as eliminating the need for a call and
return sequence, it might allow the compiler to perform
certain optimizations between the bodies of both functions.

Sometimes it is necessary for the compiler to emit a
stand-alone copy of the object code for a function even
though it is an inline function - for instance if it is
necessary to take the address of the function, or if it
can't be inlined in some particular context, or (perhaps) if
optimization has been turned off. (And of course, if you use
a compiler that doesn't understand inline, you'll need a
stand-alone copy of the object code so that all the calls
actually work at all.)

There are various ways to define inline functions; any given
kind of definition might definitely emit stand-alone object
code, definitely not emit stand-alone object code, or only
emit stand-alone object code if it is known to be needed.
Sometimes this can lead to duplication of object code, which
is a potential problem for following reasons:

1. It wastes space.
2. It can cause pointers to what is apparently the same
function to compare not equal to one another.
3. It might reduce the effectiveness of the instruction
cache. (Although in lining might do that in other ways too.)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

question-how to run a c programme.

6 Answers  


What is the -> in c?

0 Answers  


main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time.

1 Answers   Cisco,


What are integer variable, floating-point variable and character variable?

0 Answers  


how to write hello word without using semicolon at the end?

6 Answers   Accenture,






write a function for strtok()??

2 Answers   Verifone,


difference between the array and linked list general difference related to memory

2 Answers  


Can we declare a function inside a function in c?

0 Answers  


What is c preprocessor mean?

0 Answers  


What is the process to generate random numbers in c programming language?

0 Answers  


What is the general form of function in c?

0 Answers  


Which control loop is recommended if you have to execute set of statements for fixed number of times?

0 Answers  


Categories