FROM : ??? a.k.a. James Chen
DATE : Thu Nov 25 13:54:59 2004
Hi,
Shall you log like this
NSLog(@"Sum %f",sumOfNumbers(theNSArray));
HTH,
james
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Nov 25, 2004, at 4:44 PM, Ayyapu Reddy wrote:
> Hi All,
>
> What's wrong with this code?
> numbers is the array of float values (NSNumber objects).
> If i print the return value of this function, it prints Sum
> -1600107392.000000
>
> Here is the log statement NSLog(@"Sum %f",sumOfNumbers);
>
> float sumOfNumbers(NSArray *numbers){
> int i, count = [numbers count];
> float sum = 0.0;
> for(i = 0; i<count; i++){
> sum = sum + [[numbers objectAtIndex:i] floatValue];
> }
> return sum;
> }
>
> Can anybody please let me know the mystery behind this?
>
> Thanks in advance.
> Ayyapu Reddy
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Thu Nov 25 13:54:59 2004
Hi,
Shall you log like this
NSLog(@"Sum %f",sumOfNumbers(theNSArray));
HTH,
james
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Nov 25, 2004, at 4:44 PM, Ayyapu Reddy wrote:
> Hi All,
>
> What's wrong with this code?
> numbers is the array of float values (NSNumber objects).
> If i print the return value of this function, it prints Sum
> -1600107392.000000
>
> Here is the log statement NSLog(@"Sum %f",sumOfNumbers);
>
> float sumOfNumbers(NSArray *numbers){
> int i, count = [numbers count];
> float sum = 0.0;
> for(i = 0; i<count; i++){
> sum = sum + [[numbers objectAtIndex:i] floatValue];
> }
> return sum;
> }
>
> Can anybody please let me know the mystery behind this?
>
> Thanks in advance.
> Ayyapu Reddy
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Ayyapu Reddy | Nov 25, 09:44 | |
| Andy Lee | Nov 25, 10:00 | |
| ??? a.k.a. James C… | Nov 25, 13:54 |






Cocoa mail archive

