
- Forum
- Programming Talk
- C and C++
- Use of the Directive
Use of the Directive
This is a discussion on Use of the Directive within the C and C++ forums, part of the Programming Talk category; What is the use of #if directives in C programming language. If someone could provide me the syntax and it ...
-
Use of the Directive
What is the use of #if directives in C programming language. If someone could provide me the syntax and it would help me a lot.
-
The #if directive controls compilation of portions of a source file. If the expression you write after the #if have a nonzero value, the line group immediately following the #if directive is retained in the translation unit.
-
03-01-2012, 06:55 AM #3
- Join Date
- Feb 2012
- Answers
- 66
The syntax of #if is #if constant-expression newline
This directive checks whether the constant-expression is true (nonzero). The operand must be a constant integer expression that does not contain any increment (++), decrement (- -), sizeof , pointer (*), address (&), and cast operators. The constant expression in an #if directive is subject to text replacement and can contain references to identifiers defined in previous #define directives. The replacement occurs before the expression is evaluated.
-
Sponsored Ads
«
About Macros
|
about c++
»

Reply With Quote





