ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Engineering >> Engineering AllOther
 
 


 

 
 Civil Engineering interview questions  Civil Engineering Interview Questions (3076)
 Mechanical Engineering interview questions  Mechanical Engineering Interview Questions (3289)
 Electrical Engineering interview questions  Electrical Engineering Interview Questions (13331)
 Electronics Communications interview questions  Electronics Communications Interview Questions (2363)
 Chemical Engineering interview questions  Chemical Engineering Interview Questions (416)
 Aeronautical Engineering interview questions  Aeronautical Engineering Interview Questions (77)
 Bio Engineering interview questions  Bio Engineering Interview Questions (17)
 Metallurgy interview questions  Metallurgy Interview Questions (79)
 Industrial Engineering interview questions  Industrial Engineering Interview Questions (163)
 Instrumentation interview questions  Instrumentation Interview Questions (2381)
 Automobile Engineering interview questions  Automobile Engineering Interview Questions (106)
 Mechatronics Engineering interview questions  Mechatronics Engineering Interview Questions (38)
 Marine Engineering interview questions  Marine Engineering Interview Questions (43)
 Power Plant Engineering interview questions  Power Plant Engineering Interview Questions (77)
 Engineering AllOther interview questions  Engineering AllOther Interview Questions (1196)
Question
what are macros?what are its advantages and disadvantages in
c language?
 Question Submitted By :: Engineering-AllOther
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
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 ?    7 Yes 0 No
Ravi Ranjan
 
Answer
# 2
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 ?    4 Yes 2 No
Deepedra Kushwaha
 
 
 

 
 
 
Other Engineering AllOther Interview Questions
 
  Question Asked @ Answers
 
i mdoing btech and i have two choices either i choose software eng or do multimedia eng so which one has better scope   1
how are engineers exploited in these days? why do they have to do mba in todays world?   1
hi........ i am a student of computer science. i want to earn some money on net so that i can help my parents. so please suggest me some sites which give online part time jobs without any registration charges. please help me. i will be very thankful to you. varinder.   1
Q1.What do you mean by static routing and dyanamic routing? Q2.What do you mean by template in c++? Explain. Q3.What do you mean by VSAT in data communication?   1
hi this is padhu i just want to know about remote sensing scientist in ISRO, will there a written test or not if there are any model test papers plz post it.   1
what is LINUX?   5
the gravity variation on to the earth depends upon ......... what factors .. how they effect the all other parameters ........in case of body moving in up wards and as well as downwards.........   2
What do you mean by Templates?   1
why do we join in bpo?   1
THREE IS EQUAL TO FOUR InterSolution 2
what is the significance of partial derivatives. mpsc 1
which is best car to buy in india, if the budget is below or equal to 3.5 lakhs? TCS 4
 
For more Engineering AllOther Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com