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
Why do we use templates?
Should you pass exceptions by value or by reference?
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
What are the uses of static class data?
What is object oriented programming (oop)?
What is c++ programming language?
What is the full form of dos?
How one would use switch in a program?
What are the comments in c++?
What is a storage class?
Is dev c++ a good compiler?
Explain the concept of friend function in c++?
How many namespaces are there in c++?
Are c and c++ similar?
What are the advantages of c++ over c?