Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
January 23, 2018, 09:01:38 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: p. 240 - defined name  (Read 1500 times)
scokar
Newbie
*
Posts: 10


« on: 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:

Code: (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 Smiley
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114



« Reply #1 on: January 30, 2011, 11:50:11 PM »

You could have statements like this:

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

kVarName = 100;

This will assign 100 to count.

Cheers,

Steve
Logged
scokar
Newbie
*
Posts: 10


« Reply #2 on: January 30, 2011, 11:56:41 PM »

perfect, thanks!  the wording was more confusing than the example Smiley

or perhaps i should sleep... Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.