Can you please explain the difference between using macro and inline functions?



Can you please explain the difference between using macro and inline functions?..

Answer / Nivedita Valecha

Macros are textual replacements that are expanded during preprocessing, while inline functions are expanded during compilation. Macros do not have a function call overhead, but they can lead to unintended behavior due to side effects and lack of type safety. Inline functions provide the performance benefits of macros with the added advantage of type safety and avoiding issues like operator precedence.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the use of main function in c++?

1 Answers  


Is C++ case sensitive a) False b) Depends on implementation c) True

1 Answers  


What is a breakpoint?

1 Answers  


Explain the uses oof nested class?

1 Answers  


Can class objects be passed as function arguments?

1 Answers   HCL,


What do you know about near, far and huge pointer?

1 Answers  


What is the difference between public, private, protected inheritance?

12 Answers   Wipro,


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1 Answers  


What are structs in c++?

1 Answers  


Explain rtti.

1 Answers  


Explain the difference between c++ and java.

1 Answers  


What is an associative container in c++?

1 Answers  


Categories