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 (3156)
 Mechanical Engineering interview questions  Mechanical Engineering Interview Questions (3310)
 Electrical Engineering interview questions  Electrical Engineering Interview Questions (13485)
 Electronics Communications interview questions  Electronics Communications Interview Questions (2396)
 Chemical Engineering interview questions  Chemical Engineering Interview Questions (424)
 Aeronautical Engineering interview questions  Aeronautical Engineering Interview Questions (77)
 Bio Engineering interview questions  Bio Engineering Interview Questions (17)
 Metallurgy interview questions  Metallurgy Interview Questions (80)
 Industrial Engineering interview questions  Industrial Engineering Interview Questions (166)
 Instrumentation interview questions  Instrumentation Interview Questions (2409)
 Automobile Engineering interview questions  Automobile Engineering Interview Questions (109)
 Mechatronics Engineering interview questions  Mechatronics Engineering Interview Questions (38)
 Marine Engineering interview questions  Marine Engineering Interview Questions (45)
 Power Plant Engineering interview questions  Power Plant Engineering Interview Questions (81)
 Engineering AllOther interview questions  Engineering AllOther Interview Questions (1207)
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
 
Describe VCO?   1
Explain what is meant by repetition of information and inability to represent information. Explain why each of these properties may indicate a bad relational database design.   1
what is mean of i in 8i or 9i??? TCS 1
what is the differnce between pri and bri ABC 2
i mdoing btech and i have two choices either i choose software eng or do multimedia eng so which one has better scope   1
why java take 2 byte for charecter??? MAHINDRA 1
why do we use first angle projection and third angle projection only and not 2nd and 4 thangle projections? Crompton-Greaves 2
main() { float a=0.3; printf("%d\n%f",a,a); } TCS 5
100,1,99,2,98,3...... write a C pgm to generate this series with user input for the number of nos. to b displayed.. Exilant 6
What is a decade?   2
What is RIA course certification.? which is the best institute for ria courses in bangalore ? Infosys 1
An inversion is an array of numbers is any pair (i,j) such that i<j and A[i]>A[j]. What is the average number of inversions in an array of n ? distinct numbers? Infosys 2
 
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