I want to declare a c array as an instance variable (e.g. int arr[256]) in the interface block of a Cocoa object. I know that @property doesn’t support c arrays but how to manually add the getter and setter for the c array and where should I alloc and release it?
Any input will be appreciated. I really don’t want to use NSMutableArray for accessing int values.
You can use structs to wrap up an array. This is probably the one exception that allows arrays to be copied by assignment. The benefit of this approach is that there is no need to explicitly allocate or free memory.