Does the standard functions defined in header files work in #if directives?
Does the standard functions defined in header files work in #if directives?
#if a conditional compilation directive.
Syntax-#if(constant_expression)
#else
#endif
The compiler only compiles the lines that follows the #if directive wen constant_expression evaluates to non-zero.
Otherwise the compiler skips the lines that follow until it encounters the matching #else or #endif.
If the expression evaluates to false and there is a matching #else, the lines b/n the #else and the #endif are compiled.
#if directive can b nested, but matching #else and #endif directives must b in da same file as da #if.
Question is a bit vague: so treat the answer with a grain of salt.
It depends on the expression in #ifdef EXPR.
For example, if it is #ifdef __KERNEL, then standard user mode functions will not work. For example, fprintf and other user mode libc functions will not work.
Hope that helps.
Generally if is condition.Condition mean it will controls the depended statements one or more than.but #if this is also control statement but #(symbol) is used for preprocessors symbol.In this case we will define that condition in statement form afer we will use that name.
Ex>#defeine karna i>j
#if karna
printf ("i is big");
#else
printf("j is big");
#end if