Advantages of a macro over a function?
Answers
Answered by
4
One advantage is that You can use simple small names for a number of statements. You can even define macros for functions. When writing macros for functions, they saves a lot of time that is spent by the compiler for invoking / calling the functions. Hence, The advantage of a macro over an actual function, is speed.
Answered by
5
Is there any advantage of using macros in C++?
Macros are used as text substitution. One advantage is that You can use simple small names for a number of statements. You can even define macros for functions.
When writing macros for functions, they saves a lot of time that is spent by the compiler for invoking / calling the functions. Hence, The advantage of a macro over an actual function, is speed. No time is taken up in passing control to a new function, because control never leaves the home function. The macro just makes the function a bit longer. Macros may make compiling slower but the compiled programs are faster.
Please Mark this Brainliest and Follow me please
Similar questions