Conditional Compilation In C: #if #elif #else #endif

preview_player
Показать описание

In this video tutorial lets learn about preprocessor command or directives like #if, #elif, #else and #endif. These directives are used in conditional compilation.

How Does #if and #elif Work?
The block of code inside #if block works only if the condition or the expression in resolved to 0 or non-zero. If the expression is resolved to zero, then the code inside #if is skipped from compilation. If it’s non-zero number, then the code inside #if block gets compiled and executed.

Same is true for #elif: If the condition or the expression is resolved to 0 then the code inside #elif block is skipped from compilation. If it’s resolved to non-zero number then the block of code inside #elif gets compiled and executed.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

So you're telling me that I am not excellent? 😭

victorstroganov
Автор

You are not explaining the point here. We could use Normal if, elseif, else... Why use #if, what is the real time usecase for using this macro.

nidhinkk