what is differnence b/w macro & functions



what is differnence b/w macro & functions..

Answer / babitha

macro: one line function;not having any return type and
argument so it would not report error even if any
misbehaves in fnction;not having return statement;
macros would be replaced by that functions/value where ever
macro name presents;if we need any later change in funcions
then modifing only at macro is neccssary, sicne it is
replacing wherever macro name presents.

functions:we would recieve error if the function call and
function prototypes are mismatch;xplicitly it should have
one return statement if the retrun type of fucntion is
aother than void;control from main function would jump to
function defintion of called fucntion if that function is
called rather than replacing the function;it may have moe
than one line function.If we want later change i fucntion
execution,then we need to modify on function prototype(if
modified),fucntion defintion and whereever that function is
called.

Is This Answer Correct ?    4 Yes 2 No

Post New Answer

More C Interview Questions

c program to arrange digits in a no in ascending and descending order

1 Answers  


for example user gives input as " 20 or 20.0 or rs 20.0 or 20.00 or rs20 and so .. on " and the output should be stored as " rs.20.00 " in a variable

2 Answers  


What is the g value paradox?

0 Answers  


discuss the steps needed to get a program from source code to executable in a system?

1 Answers  


What are the __date__ and __time__ preprocessor commands?

0 Answers  






What is the difference between single charater constant and string constant?

0 Answers  


What is NULL pointer?

0 Answers   Infosys,


Are bit fields portable?

0 Answers   EXL,


how to create duplicate link list using C???

0 Answers  


Write a program to check prime number in c programming?

0 Answers  


What is wrong with this code?

0 Answers  


what is event driven software and what is procedural driven software?

0 Answers  


Categories