what are macros?what are its advantages and disadvantages in
c language?
Answer Posted / deepedra kushwaha
A macro is a name given to a block of C statements as a
pre-processor directive. Being a pre-processor, the block of
code is communicated to the compiler before entering into
the actual coding (main () function). A macro is defined
with the preprocessor directive, #define.
The advantage of using macro is the execution speed of the
program fragment. When the actual code snippet is to be
used, it can be substituted by the name of the macro. The
same block of statements, on the other hand, need to be
repeatedly hard coded as and when required.
The disadvantage of the macro is the size of the program.
The reason is, the pre-processor will replace all the macros
in the program by its real definition prior to the
compilation process of the program.
Describe the advantages of using macro.
A macro is a name given to a block of the code which can be
substituted where the code snippet is to be used for more
than once.
- The speed of the execution of the program is the major
advantage of using a macro.
- It saves a lot of time that is spent by the compiler for
invoking / calling the functions.
- It reduces the length of the program.
| Is This Answer Correct ? | 16 Yes | 11 No |
Post New Answer View All Answers
what is the difference between VARCHAR and VARCHAR2?
a book consists of chapter ,chapter consist of sections and sections consists of subsections.construct a tree and print the node.
why one should join accenture?
Explain the following program segment. f(){ int *b; *b=2; }
What is the pattern for HAL Online-exam?
hi,i came to US to pursue my masters in computer information technology.Can i do my masters the first 6months in US and the rest 9 months course from INDIA through online education
What is the difference between CD-R and CD+R?
what is the difference between public static void main (String args[]) and static public void main(String args[]) in java?
What is the difference between a .PST file and a .OST file?
What are daemon Threads?
i possess a little knowledge of core java . so is it will be difficult for me to start advanced java?
hai im going to face ibps SO IT officers grade 1 interview. if anyone had an idea plz tel me expected and experienced questions and mail to anusha_k_anu@yahoo.com
what is the difference between embedded system and PLC. Whether the micro controller accept future expansion of program?
What is the actual procedure of charging synthetic oil if the machine is under positive refrigerant pressure.
what is technical voice process and define it