I want to print the value of the variable, which has the highest value. I want to do this by using the preprocessor, but I don't know how to do this. It's easy to do this by using if-else, but how to do that by using preprocessor? This is my code
#include <stdio.h>
#define MAX(a,b,c)
#if a > (b && c)
# define a
#endif
#if b > (a && c)
# define b
#else
# define c
#endif
int main (void)
{
int wynik;
int a = 6;
int b = 13;
int c = 9;
wynik = MAX(a,b,c);
printf("%i", wynik);
return 0;
}
And this is the errors from my terminal
E:\skrypty_c>gcc -o Cwiczenie12_4.exe Cwiczenie12_4.c
Cwiczenie12_4.c: In function 'main':
Cwiczenie12_4.c:17:11: error: expected identifier or '(' before '=' token
int c = 9;
^
Cwiczenie12_4.c:18:23: error: expected expression before ';' token
wynik = MAX(a,b,c);
#definerequires a single "line", and cannot include other#-style pre-processor directives like this.