• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Just starting off in obj C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Just starting off in obj C


  • Subject: Re: Just starting off in obj C
  • From: Ken Thomases <email@hidden>
  • Date: Fri, 24 Oct 2008 17:09:16 -0500

On Oct 24, 2008, at 5:03 PM, Michael wrote:

Is there an obvious reason why this is not working?


#import <Foundation/Foundation.h>

NSString *mytest();

int main (int argc, const char * argv[]) {

NSLog(@"This is %@", mytest);

You haven't called the mytest function here. Just naming a function without a following open parenthesis takes the function's address.


You want:

	NSLog(@"This is %@", mytest());

By the way, this is an issue with plain C. It's not specific to Objective-C.


return (0); }


NSString *mytest() { return (@"foobar"); }

Cheers, Ken

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Just starting off in obj C
      • From: Michael <email@hidden>
References: 
 >Just starting off in obj C (From: Michael <email@hidden>)

  • Prev by Date: Re: Just starting off in obj C
  • Next by Date: Re: Just starting off in obj C
  • Previous by thread: Re: Just starting off in obj C
  • Next by thread: Re: Just starting off in obj C
  • Index(es):
    • Date
    • Thread