How could I pass the float number by value in obj-c?

Posted by user313439 on Stack Overflow See other posts from Stack Overflow or by user313439
Published on 2010-04-22T08:42:29Z Indexed on 2010/04/22 8:53 UTC
Read the original article Hit count: 205

Filed under:

- (void)applicationDidFinishLaunching:(UIApplication *)application{

// Override point for customization after application launch
[window makeKeyAndVisible];
[self printFloat:1.3f];
}

- (void)printFloat:(float)f { 
    NSLog(@"%f",f);
}

I passed the "1.3f" to printFloat, but it was the wrong value (in this case, -2.000000) after "f" received. And there is a warning that "AppDelegate may not respond to -printFloat:"

Where did I get it wrong? Thanks.

© Stack Overflow or respective owner

Related posts about objective-c