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

Which language is not a true object oriented programming language?

0 Answers  


What is encapsulation process?

0 Answers  


Can anyone please explain runtime polymorphism with a real time example??at what ciscumstances we go for it??

1 Answers  


What is difference between function overloading and overriding?

1 Answers   emc2,


what is code for call by value and call by reference?

1 Answers  






Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

0 Answers  


What are the 3 pillars of oop?

0 Answers  


what is the drawback of classical methods in oops?

0 Answers  


what is meant by files?

4 Answers   Infosys,


write a program to find 2 power of a 5digit number with out using big int and exponent ?

0 Answers  


How oops is better than procedural?

0 Answers  


#include <iostream> using namespace std; int main() { int a = 2; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][c[1][4]]; }

2 Answers   TCS, Wipro,


Categories