what are macros?what are its advantages and disadvantages in
c language?
Answer Posted / ravi ranjan
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.
Like::: #define A 10
#define SUM(x,y) ((x) + (y))
Advantages :::
1.Symbolic constants are evaluated by the PRE-processor,
i.e. they are re-written as literal values, not as
variables. this has some nice side-effects that you can do
using symbolic defines eg. macros and functions inside them.
run-time access to symbolic constants should be
significantly faster than access to variables.
opposite to that, variables (and constants) are evaluated by
the processor (compiler).
2. It is easy to modify the value of the constant
variable,since we have to change the value at the macro
defintion only
DisAdvantages:::
1. Macros are not useful when the function definitions are
Big and when the function is used many number of times.
| Is This Answer Correct ? | 52 Yes | 14 No |
Post New Answer View All Answers
what will happend if i fire this command in linux " rm -r / "
plz plz help me "how can i face dell varcent round"....? plzzzzzzzz help me friends.....?
100 computers ip how to calculate
what is recursion in c language?
How to freely move a ball in graphics mode.
Why do you want to work here
T is a tree and V is a vertex of T of maximum degree in T, say the degree of V in n. Prove that T has atleast n vertices of degree 1.
how to delete four out of five duplicate records in a table using sql
A short CI column of hollow circular section has projecting bracket carrying a load of 10 tonnes. The load line is off the column by 20cm. The external diameter of the column is 350mm and thickness of metal is 25 mm. Find the maximum stress intensity in the section.
HI i have 2 year manual testing exp from MNC in pune but due to some reason i am looking job in testing . Friends hepl me to get the job i am not getting calls. alim24@gmail.com.09860643281
tell me one scenario where we go for idoc and WHy we go for idoc.
sir, please send me the last three years exam papers conducted by CPCL- RECRUITMENT EXAM FOR Recruitment of Engineer ELECTRICAL ENGINEERING. A Soon as possible. i would be greatfull to u
how is the config take place and from reciever side how will process the data into internal table
how to cable size by Amp with example
A polynomials in mamory can be represented by____________