Preprocessor #if directive
- by Caslav
I am writing a big code and I don't want it all to be in my main.c so I wrote a .inc file that has IF-ELSE statement with function and I was wondering can it be written like this:
#if var==1
process(int a)
{
printf("Result is: %d",2*a);
}
#else
process(int a)
{
printf("Result is: %d",10*a);
}
#endif
I tried to compile it but it gives me errors or in best case it just goes on the first function process without checking the var variable (it is set to 0).