Which one is better- macro or function?



Which one is better- macro or function?..

Answer / Sachchidanand Shukla

The choice between macros and functions depends on the specific use case. Macros are faster as they are expanded at compile time, but they lack type safety and can lead to unintended side effects. Functions provide type safety, encapsulation, and modularity but might incur a slight performance overhead.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

advantages and disadvantages of using Borland C++ / version 5.

1 Answers  


What does I ++ mean in c++?

1 Answers  


What is the purpose of decltype?

1 Answers  


What do you mean by function and operator overloading in c++?

1 Answers  


Explain linked list using c++ with an example?

1 Answers  


what are Access specifiers in C++ class? What are the types?

1 Answers  


What jobs can you get with a c++ certification?

1 Answers  


Explain the differences between list x; & list x();.

1 Answers  


What is a storage class used in c++?

1 Answers  


What is the meaning of c++?

1 Answers  


Define friend function.

1 Answers  


When must you use a pointer rather than a reference?

1 Answers  


Categories