What is the Difference between Macro and ordinary
definition?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ambar
macro is an independently executive function which executes
only when called from within the calling program . each
time it is called it takes a different parameter whearas an
ordinary defination parameters remains same till the life
of a program.
Is This Answer Correct ? | 11 Yes | 2 No |
Answer / himanshu goel
macro definitions can be used for conditional compilation
whereas ordinary cannot
Is This Answer Correct ? | 8 Yes | 13 No |
What is the difference between scanf and fscanf?
What are control structures? What are the different types?
what are the facialities provided by you after the selection of the student.
How does C++ help with the tradeoff of safety vs. usability?
What's the difference between calloc() and malloc()?
Explain what are binary trees?
How can I dynamically allocate arrays?
what will be the result of the following program ? char *gxxx() { static char xxx[1024]; return xxx; } main() { char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); } a) The string is : string b) The string is :Oldstring c) Run time error/Core dump d) Syntax error during compilation e) None of these
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
What is the use of getchar() function?
c program to subtract between two numbers without using '-' sign and subtract function.
what is the difference between global variable & static variable declared out side all the function in the file.