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
What is static class data?
What do you mean by const correctness?
What are the effects after calling the delete this operator ?
Why do we need pointers?
What is the extraction operator and what does it do?
Incase of a function declaration, what is extern means?
What is lazy initialization in c++?
What is #include iostream?
Is it possible to use a new for the reallocation of pointers ?
What is binary search in c++?
Difference between overloaded functions and overridden functions
What is the difference between reference and pointer?
What is the best c++ compiler for windows 10?
Can you declare an array without a size in c++?
What is lvalue?