Return to Snippet

Revision: 64101
at July 4, 2013 21:48 by pecta


Initial Code
// http://stackoverflow.com/questions/5728998/objective-c-casting-int-to-float

// First objective c style

int b = 10;
float a = [[NSNumber numberWithInt: b] floatValue]
There will be NSNumber instance and messages numberWithInt, floatValue will be send, right?

// Second c style

int b = 10;
float a = (float) b;

Initial URL

                                

Initial Description
method to convert int to float in ObjC

Initial Title
Casting int to float

Initial Tags
convert

Initial Language
Objective C