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
why there is a collision in switch
why multiple inheritence concept is not supported in c#?
is java supprot the complier time pollymorphism or run time pollymorphism ... why
Draw a pipeline configuration to carryout the following operations on the arrays of data represented by A, B, C, D, E and F. (A i represents the i th element of the array). (Ai × Bi + Ci × Di ) (Ei × Fi ) Show the content of the pipline for i = 1 to 5
A company canteen needs an automated system for its food and beverage management. The canteen receives food and beverage items from different distributors. All the non perishable items are stored in the store-room and the perishable items are put in the fridge. The manager should be able to add, delete or update food and beverage items onto the system and perishable and non perishable item details are to be stored separately. Both waiters and the cooks should be able to update the perishable items, but only the cooks should be allowed to update the non perishable items. Both cooks and waiters are not allowed to add or delete any items that are entered. identify the Schema, Table , Fields
in b+ trees, all the data is stored in leaf nodes. if all leaf nodes are crashed then how to get/recovery the data back?
I am 2012 pass out b tech student(cse). i have recently started software manual testing class. Is this field is benefitial for me in future?
pls send me rrb se(s&t)questions
where is the first engeenering college of Asia
Can you connect Active Directory to other 3rd-party Directory Services? Name a few options.
PLEASE SUGGEST THE BALLY PLACEMENT PAPER PATTERN ABOUT WRITTEN TEST,INTERVIEW,HR.ITS URGENT. AS BALLY IS GOING TO VISIT OUR CAMPUS.
How to recyling of Expired Computer/Laptop,Mouse,CPU & Key Board (Warranty)?
i need to know abt renault nissan company and the rounds and type of questions asked by today
I want old SBI question papers plzzzzzzzzz
There are three bucket...Apple,Orange and Apple+Orange....On each Bucket one of the following labels are there..'A','O','A+O'...all this labels are not correctly patched on Bucket..identify which bucket contains What? You can not see bucket..u can pick any number of fruit from any basket...???