Saturday, July 21, 2012

convert NSArray in float[]


        NSArray *c=[NSArray arrayWithObjects:@"1",@"8",@"4",@"2",nil];
        
        NSEnumerator *enumerator;
        float * cArray;
        id obj;
        int index=0;
        
        cArray = (float *) malloc(sizeof(float) * [c count]);
        enumerator = [c objectEnumerator];
        while(obj = [enumerator nextObject])
        {
            cArray[index] = [obj floatValue];
            index++;
        }
        



       


3 comments:

  1. Obviously, this is still a slooooooow thing to do, so take after ThemsAllTook's recommendation and don't utilize a NSArray for this if conceivable. What I'd do, by and by, is given NSArray a chance to deal with your capacity while you're building or generally controlling your information. Be that as it may, once your information's prepared, duplicate it over to a crude exhibit and let go of the NSArray. Visit website.

    ReplyDelete
  2. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to article very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    DedicatedHosting4u.com

    ReplyDelete