Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

i have passed my gRaduation in BCA and now im looking for post graduation from Germany, i haver passed my ielts wth 6 band, nw plz tell me some question that wll ambessay ask

1855


How does an aeroplane stay airborne and how can some aeroplanes fly upside down?

1082


How will I MOve Comp-1 variable into next variable without using Move statement?

2112


what is the program to find out the smallest word in a sentence? like if the sentence is : this is my room. then out put will be : is

1812


plz send me how to overhauling of freon bitzer semi receprocal comprassors with available video

1935


explain various object oriented programming fetures

1788


Just a one miniute topics in English?

1845


Hi, I am preparing for Assistant Motor Vehicle Inspector (AMVI) exam.If any body having old question papers please send.My mail id is siyadndd@gmail.com

2234


I want old SBI question papers plzzzzzzzzz

1966


what is c dot

1956


Given a number (N), program to check whether its binary form has periodic or not

2271


safety valve calculation?

2628


how to find out the name of the users who are currently working starting with the same characters in unix os

1896


how am i supposed to convert a class program in C++ to Matlab? Do i also need to make classes in matlab too or I can do it without making classes???Can somebody help....

1953


write program which accept information about 5 student & display same information according to ascending order of their name??

2953