C++ Inline Function Question:
Download Questions PDF

Explain the difference between inline functions and macros?

C++ Inline Function Interview Question
C++ Inline Function Interview Question

Answer:

A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros: Object-like macros and function-like macros.

Inline function is a function that is expanded in line when the function is called. That is the compiler replaces the function call with the function code (similar to macros).

The disadvantage of using macros is that the usual error checking does not occur during compilation.

Download C++ Inline Function Interview Questions And Answers PDF

Previous QuestionNext Question
Described the advantages of using macro and inline functions?Does the inline functions improve performance?