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...

difference between macro and function?

Answer Posted / subrat pattnaik

1.In Inline function if the codes are too much it acts as
normal function(without expanding in a line it gets jumps to
fun defination) but this is not with macro(it gets inserted
were it is calleed without checking its bulkness).
2.Suppose
#define square(x) (x*x)

inline void SQUARE(int x)
{
x*x;
}

void main()
{
a=5;
cout<<"The square is "<<square(++a);
cout<<"The SQUARE is "<<SQUARE(++a);
}
Here in macro it will b ++a * ++a(a incrementing 2 times)
In inline it will get incremented and is squared(++a)^2
Thanks

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is binary object model?

969


What is struct c++?

951


How do you compile the source code with your compiler?

1004


Which operator cannot overload?

992


Write a program using display() function which takes two arguments.

1013


What is null and void pointer?

999


What is pure virtual function?

1024


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1039


How does list r; differs from list r();?

1091


What is the difference between map and hashmap in c++?

1039


How do I get good at c++ programming?

1087


Why do we use setw in c++?

1058


How do you master coding?

988


Is c++ pass by reference or value?

1005


Does c++ have a hash table?

945