• 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: What's wrong with this code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's wrong with this code?


  • Subject: Re: What's wrong with this code?
  • From: Andy Lee <email@hidden>
  • Date: Thu, 25 Nov 2004 04:00:08 -0500

Your NSLog statement is wrong:

NSLog(@"Sum %f",sumOfNumbers)

You didn't put the argument list after sumOfNumbers, so this statement doesn't call your function at all. Instead, you are passing NSLog the address of the sumOfNumbers function, which NSLog tries to interpret as a float.


You could have figured this out yourself by putting a breakpoint in the sumOfNumbers() function and stepping through with the debugger. Or you could have added NSLog statements inside the function printing the values of count and sum. Either way, you would have seen that the function never gets called.

--Andy

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


References: 
 >What's wrong with this code? (From: Ayyapu Reddy <email@hidden>)

  • Prev by Date: NSDocument notification
  • Next by Date: background of NSButton and NSPopUpButton
  • Previous by thread: What's wrong with this code?
  • Next by thread: Re: What's wrong with this code?
  • Index(es):
    • Date
    • Thread