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
if a customer's blackberry stopped syncing their calendar wirelessly what would you do?if a customber deleted mail from his blackberry but it did delete from his mailbox how would ypu resolve this
plz send me how to overhauling of freon bitzer semi receprocal comprassors with available video
Guys! I coplted 10th with 80% and +2 with 64% now am dng c.s.e b.tech...i want to go abroad for higher studies i want to write tofel...plZ GIVE UR SUGGESTIONS!
hi friends i am first time using this site.i came to by some tcs personals that certifications r important for placements.i am financially average i am learning java from books.please tell is it enough if not which certification should i go for
how will u recieve idoc
what is b tree
i am Ali from Hyderabad,having twice rejected on conference visa(USA),possessing 9 years of teaching experience,my current ielts score is 6 bands and my current age is 34,do suggest me some suitable universities for MBA course in USA,and what are the prospect of getting a visa.
An inversion is an array of numbers is any pair (i,j) such
that i
friends help me..am a btech fresher.. wt is the eligibility criteria for TCS???? like %...repli me clearly from x onwards..
There are n points and each point enclose with x and y axis form a rectangle and find the point using a program which forms the smallest rectangle?
Please send me the ongc old question papers
please tell me difference between router and cisco router
what are all the browsers..?
why there is a collision in switch
I have Job A and Job B in jcl. I want to trigger Job B from Job A. Please advise.