I would like to know how to return float array in methods.
In methods like:
- (float *) ......{
float * result = malloc(sizeof(float) * number);
....
return result;
}
My problem is that I didn't clean result float array. How can I do that?
My problem is that i didn't clean result float array.
That's the job of whoever is calling your method that returns the float array: now he owns it, so he must call free
on it.
Generally, there are two situations:
free()
passing it the array.dealloc
method to your class, and call free()
on the array variable from there.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With