Differences between inline functions and non-inline functions?

Answers were Sorted based on User's Feedback



Differences between inline functions and non-inline functions?..

Answer / madhu

Actually inline functions are used to overcome the demerits
of preprocessor macros and non-inline functions.
Whenever a function call is made function address, formal
arguments and return address will be stored in the stack.
Which leads the overhead to the compiler. To overcome this
inline functions are introduced.

Inline functions are the requester to the compiler to
replace the function definition at the function callers.
Here it is same as preprocessor macros but not equal to 100%
to macros.
The decision of implementing inline is done by compiler.
Points to be consider b/w inline && non-inline functions:
1. inline executes faster than non-inline functions.
2. Using inline will increase the code size than the
non-inline functions.
3. inline are ignored if the function definition contains
more code or loops or conditions.
4. if you define a function inside the class by default it
will treat it as a inline.

Is This Answer Correct ?    34 Yes 3 No

Differences between inline functions and non-inline functions?..

Answer / rajesh kumar

In non-inline function when a function calls the controller
jumps to the function definition, but whereas in Inline
Function when a function calls the code in the function
replaced instead of jumping the controller.

Is This Answer Correct ?    35 Yes 11 No

Differences between inline functions and non-inline functions?..

Answer / ashu_deepu

inline function are those function in which the code is just inserted where the function is declared.
it is generally used for function which are small in size and don,t involve any loop.
it just a way to decrease the time of function call.

Is This Answer Correct ?    12 Yes 3 No

Differences between inline functions and non-inline functions?..

Answer / ankita

inline functin for execution switching time is required but
noy in case of non inline function

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More OOPS Interview Questions

What is methods in oop?

0 Answers  


can we make game by using c

1 Answers   SmartData,


1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)

1 Answers   Nagarro,


What is class and object in oops?

0 Answers  


How to call a non virtual function in the derived class by using base class pointer

3 Answers   HCL,


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

0 Answers  


how do you handle yourself when you feel the wald is aganist you

2 Answers  


who is the founder of c++?

15 Answers   Hexaware, ONGC,


What is inheritance in simple words?

0 Answers  


what type of questions

0 Answers   IBM,


sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....

2 Answers  


What is oops concept with example?

0 Answers  


Categories