Changes

Jump to: navigation, search

Using Objective-C Preprocessor Directives

5 bytes added, 20:30, 12 November 2009
The #define Statement
== The #define Statement ==
The #define statement can be used for a variety of purposes and is probably the most flexible of preprocessor directives. Perhaps one of the most common uses is to give frequently used constant values in a program a programmer friendly name and single point of definition. For the sake of an example, lets say you need to frequently use the boiling temperature of water (a point of contention but for the purposes of this example we will assume it to be 99.61 degrees Celsius) throughout your Objective-C program. One option might be to simply enter the constant value wherever it is needed. For example:
<tt>double liquidTemp = 99.61 - ambientTemp;</tt>

Navigation menu