Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan

Old Stuff => Chapter 12 - The Preprocessor => : scokar January 30, 2011, 11:41:09 PM

: p. 240 - defined name
: scokar January 30, 2011, 11:41:09 PM
I don't understand these two sentences:

"A defined name is not a variable.  Therefore, you cannot assign a value to it unless the result of substituting the defined value is a variable"

I understand the 1st part:

: (Objective-C)
#define TRUE 1

The TRUE is NOT a variable and cannot be modified.

The second part does not make sense to me, can some phrase that differently or provide an example?

Thanks :)

: Re: p. 240 - defined name
: skochan January 30, 2011, 11:50:11 PM
You could have statements like this:

: (Objective-C)
#define kVarName  count
int count;

kVarName = 100;

This will assign 100 to count.



: Re: p. 240 - defined name
: scokar January 30, 2011, 11:56:41 PM
perfect, thanks!  the wording was more confusing than the example :)

or perhaps i should sleep... :)

Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.