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
CSS corp interview process and placement papers
Q1 Design a webpage for a hotel which displays all the information of the hotel such as rooms available, facilities, and packages along with rate list. Apply the different tags available to give it a good style.
discus the worst and best case complexity of binary search
plz tell me which books r important for gate exam (CSE)
what is the definition(body) of a default constructor in c++?
What experience have you had in writing technical materials?
write a program to reverse a string using recursive function without using str functions.
how to use two diffirent gatway in one system
Explain momentum?
Create an midp application which examines that a phone number which has enters is in the given format * Area code should be one of the following:040,041,050,0400,044
95) func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d ! ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); please help me in detail ....with flowchart
how much the percentile as a good percentile in elitmus.
why IT?
what are register variables?what are the advantages of using register variables in c language?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.