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 the object serialization?
How can you quickly find the number of elements stored in a static array?
Is it possible to provide default values while overloading a binary operator?
Do you need a main function in c++?
what you know about c++?
Can we specify variable field width in a scanf() format string? If possible how?
Are strings mutable in c++?
How to declare a function pointer?
What is the difference between equal to (==) and assignment operator (=)?
What are the basics of local (auto) objects?
Who made c++?
What are pointer-to-members? Explain.
What is microsoft c++ redistributable?
What do you mean by late binding?
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?