I am working with converting C functions into pre-processor MACRO in c language. I know that for example:
int plus(int x, int y) {
return x + y;
}
will be as:
#define PLUS(x, y) ((x) + (y))
in pre-processor MACRO in C language. My question is what would:
int factorial(int n) {
if (n == 0)
return 1;
else
return n * factorial(n - 1);
}
look like as pre-processor MACRO in C language. I have tried:
#define FACTORIAL(n) (n == 0 ? : n * FACTORIAL(n - 1))
But it is not working. Any tips?