Sponsored Ad

Thursday, November 26, 2009

Pre-Processor Conditional Directives

Basic Usage

The most often used of directives are:-

  • #define
  • #if
  • #endif

The directive # define to define a preprocessor variable, this is pretty useless by itself but is used in connection with the case #if and # endif allows you to compile code depending on whether a variable is defined. Gray with Visual Studio that will not compile.

Example 1

clip_image001

Example 2

clip_image002

Notice the grey line of code on line 14; this will not be executed as it is not compiled

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers