What is the difference between macros and inline functions?

Answer Posted / vishal

1> Macros are always expanded by pre-processor, whereas compiler may or may not replace the inline definitions. You cant force compiler to make a function inline. It is purely compiler based decision.

2> Debugging macros is also difficult.

3>  Expressions passed as arguments to inline functions are evaluated once. In some cases, expressions passed as arguments to macros can be evaluated more than once.

Here i got exact answer : http://www.firmcodes.com/difference-macro-inline-c/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is typeof in c?

606


What is calloc malloc realloc in c?

593


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

1768


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1591


Why is c fast?

602






How can I do peek and poke in c?

617


What are the advantages of c preprocessor?

713


will u please send me the placement papers to my mail???????????????????

1362


What is c preprocessor mean?

790


What are the valid places to have keyword “break”?

649


explain how do you use macro?

667


Explain why can’t constant values be used to define an array’s initial size?

854


How can you increase the size of a statically allocated array?

612


Explain how can I write functions that take a variable number of arguments?

610


Why is c not oop?

535