Amazon.com Widgets Local Variables
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 20, 2014, 08:40:22 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Programming in Objective-C, 4th edition
| |-+ Chapter 7
| | |-+ Local Variables
Pages: [1] Go Down
Print
Author Topic: Local Variables (Read 651 times)
MCaEd
Newbie
*
Posts: 49






on: February 20, 2012, 11:34:40 AM

When talking about the loval variables in the book, there is an example of reduce method.
The book says:
Quote
The three local variables in the reduce method are set to values before they are used...
- p.140
But if you look at the code, one of these variables temp is not set to any values:
Quote
int temp;
Why?
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #1 on: February 20, 2012, 12:58:57 PM

It's not well-worded.  All three variables are set before they're used; temp gets set a little later (inside the loop), but again, it gets set first before its value is used.   

Thanks,

Steve
Logged
MCaEd
Newbie
*
Posts: 49






Reply #2 on: February 21, 2012, 04:58:06 PM

Thank you, Steve.
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

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 (c) 2009 classroomM.com. All rights reserved.