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 use of map in c++?
How is modularity introduced in C++?
Give 10 points of differences between C & C++.
Is c or c++ more useful?
Differentiate between C and C++.
Define what is constructor?
What is public, protected, private in c++?
What character terminates all character array strings a) b) . c) END
What is struct c++?
What are containers in c++?
What is ios class in c++?
Is c++ double?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
Is recursion allowed in inline functions?
Describe linkages and types of linkages?