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
Can notepad ++ run c++?
Can malloc be used in c++?
What is polymorphism and its type in c++?
Describe private, protected and public?
What are the advantages of prototyping?
What is virtual base class uses?
Show the declaration for a pointer to function returning long and taking an integer parameter.
How much do c++ programmers make?
Can you explicitly call a destructor on a local variable?
What is a pointer with example?
What is stack unwinding?
What are virtual functions in c++?
Why should you learn c++?
Difference between struct and class in terms of access modifier.
How many different levels of pointers are there?