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 data abstraction? How is it different from data encapsulation?
What is the best way to take screenshots of a window with c++ in windows?
What will the line of code below print out and why?
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
What is math h in c++?
Is nan a c++?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
Can we declare a base-class destructor as virtual?
What are c++ redistributables?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
What is virtual table?
Write bites in Turbo c++ Header ("Include") Files.
What is the difference between an enumeration and a set of pre-processor # defines?
What is else syntax in c++?
What does std mean in c++?