I will explain through cases:
If you first declared a function, then the function, for example, the second macro, the macro will execute the function. that is, it will always be called instead of a function.
double squar(double x)
{
return x*x;
}
#define squar(x) (x*x)
On the other hand, if you declare a macro first and then a function, an exception occurs, you cannot build
#define squar(x) (x*x)
double squar(double x)
{
return x*x;
}
In the end, in the first case, you still call the function, as @Hayri Uğur Koltuk said here in his answer(squar)(5)
source
share