Anonymous

How Does An Inline Function Differ From A Preprocessor Macro?

1

1 Answers

Anonymous Profile
Anonymous answered
Inline functions copy the function at that place at the time of compilation
but macros just copy and paste the code written
you will understand better by this example

#define mul(a,b) a*b
int main()
{
int c=sum(3+2,2);
return 0;
}

your expected answer will be 10
but the program returns 7.
I'll leave it for you to figure out why.
And yes inline function will give you the correct anser for this.

Answer Question

Anonymous