Amazon.com Widgets Chapter 13 page 290
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 19, 2013, 02:00:01 AM
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
|-+  Old Stuff
| |-+  Chapter Study
| | |-+  Chapter 13 - Underlying C Language Features
| | | |-+  Chapter 13 page 290
Pages: [1]   Go Down
Print
Author Topic: Chapter 13 page 290  (Read 1105 times)
wellaged37
Newbie
*
Posts: 39






« on: May 24, 2009, 05:49:38 PM »

I have no C background so I thought that if I worked through chapter 13 I could add to whatever knowledge of C I have learned so far. Then on page 290 I came across the two lines:
        Fraction * fractsPtr;     ( 1st printing Dec 2008)
        Note that this is the same declaration used to define a Fraction object
At the time these two lines made sense to me. But, when I checked the errata the first line changed to:
        Fraction **fractsPtr;
and the second line remained unchanged. To me, the second line no longer made any sense because the first line now had two asterisks and the second line would only have one when an object is defined - like so:
       Fraction *myObj = [[Fraction alloc] init];
Why the two asterisks? A pointer with two asterisks?
I would appreciate anyone's thoughts on this.
Logged
bighugedave
Newbie
*
Posts: 5






« Reply #1 on: May 26, 2009, 05:55:43 AM »

Heya wellaged37,

I'm not sure why there are two asterisks for that specific example, anytime I've declared objects I've only used one asterisk.

It is possible to use two asterisks in objective-c, from what I've been told.  Here's a link to a good description of it.  Basically it's just a pointer to a pointer.

http://stackoverflow.com/questions/833112/what-does-having-two-asterisk-in-objective-c-mean

Regards,

David
Logged

All attempts to coerce the living will of human beings into the service of something they do not want must fail. - Ludwig Von Mises
wellaged37
Newbie
*
Posts: 39






« Reply #2 on: May 26, 2009, 06:41:42 AM »

Hi Dave,
Thanks for the link. I think it is just what I need. It will take some time to digest the information but I'm hopeful I'll understand it. Without looking at the solution on the forum I'm trying to do Chap 13 Ex 4 two ways - first by passing an array and second by passing a pointer.
Thanks again and as an aside I'm a fan of Ludwig von Mises.

Cheers, John
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.