What is the Difference between Macro and ordinary
definition?

Answer Posted / d g patel

1. Macro takes parameters where as ordinary definition does
not.
2. Based on the parameter values to macro it can result in
different value at run time. Ordinary defination value
remains same at all place at run time.
3. Macro can be used for conditional operations where as
definition can not.
4. Using macro one can achieve inline functionality in C
ie. macro can be a function performing simple operations.
This is not possible using definitions.

Is This Answer Correct ?    46 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

727


Why is sprintf unsafe?

612


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

714


What is dynamic variable in c?

557


What is the difference between functions abs() and fabs()?

641






Explain the use of function toupper() with and example code?

645


How to Throw some light on the splay trees?

613


How can I remove the leading spaces from a string?

623


What are volatile variables in c?

512


What is the full form of getch?

573


write a program to display all prime numbers

1448


What are the application of void data type in c?

687


What is %lu in c?

674


Explain what is the general form of a c program?

616


What are lookup tables in c?

543