Skip navigation.
 
mlRe: What's wrong with this code?
FROM : Andy Lee
DATE : Thu Nov 25 10:00:08 2004

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

Related mailsAuthorDate
mlWhat's wrong with this code? Ayyapu Reddy Nov 25, 09:44
mlRe: What's wrong with this code? Andy Lee Nov 25, 10:00
mlRe: What's wrong with this code? ??? a.k.a. James C… Nov 25, 13:54