Difference between Macros and Functions in C | Comparing macros & function in C | C language macro, User Defined Functions, PDF, Macros in C | Working of Function and macro in C Programming

Difference between Macros and Functions in C | Comparing macros & function in C | C language macro, User Defined Functions, PDF, Macros in C | Working of Function and macro in C Programming 

 


Macros
Functions
Macro calls are replaced with macro expansions (meaning).

In function call, the control is passed to a function definition along with arguments, and definition is processed and value may be returned to call
Macros run programs faster but increase the program size.
Functions make program size smaller and compact.
If macro is called 100 numbers of times, the size of the program will increase.
If function is called 100 numbers of times, the program size will not increase.
It is better to use Macros, when the definition is very small in size.
It is better to use functions, when the definition is bigger in size.


No comments:

Post a Comment