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


Please Help Members By Posting Answers For Below Questions

Let an denote the number of bit strings of length n that do not have two consecutive zeroes. Find a recurrence relation for the number of bit strings of length n that do not have two consecutive zeroes. Hence find a4.

1887


what is the difference between oracle 8i vs 9i

1772


I am getting the following error,when I am running the script, Cannot identify the specified item of the regions object. Confirm that the specified item is included in the object's item collection. My Script: Itemname=Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetItem(i+1) Print Itemname Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").Select "Itemname" Any Help? Thanks, Uma

1758


What is the difference between a .PST file and a .OST file?

3433


Has anyone attended any interviews in IITs for the positions like Research Associates/Fellowships?

1423






How to calculte strengh of scaffoling(indian)

1628


How to work Air cooled and water cooled chiller?

1329


PLEASE SUGGEST THE BALLY PLACEMENT PAPER PATTERN ABOUT WRITTEN TEST,INTERVIEW,HR.ITS URGENT. AS BALLY IS GOING TO VISIT OUR CAMPUS.

1942


hi all I got two exam call letter one from maha ganeco & other from federal bank both at same time & same date which should i choose (note I am eng. grad.)

1693


hi this is amit..please help me to out this problem Objective 8: Create Resources (Function libraries) Requirements: Create a new order with the Flight Reservation application. 33. Use the script created above. 34. Write a function using VBScript that will take a date as an input and add 10 to it. i.e. if the date is passed as “15/08/2008” then after adding 10 it should become as “25/08/2008” 35. Use this function to parameterize the step used to enter “Date of Flight” 36. Run the pack thanx & regards

1734


why view is created in database

1231


A rectangular sheet dimensions a x b is to be made into an open-topped box by cutting a square of side h from each corner and folding the 4 sides up. Find the value of h which allows the maximum volume of the box?

735


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.

1505


how to generate linked implementation of sparse matrix?

1499


Differentiate between data base and data mart?

1664