I just came across a line of code that was written by a co-worker and I've never seen this before in Obj-C. It looks like poor form and I want to change it, but it seemingly works (the app is working as expected) and I don't even know what to change it to.
NSString **stringArray= new NSString *[numberOfStrings];
Is this OK? Would an NSArray of NSStrings make more sense?
EDIT: In order to properly free the array from memory, are any release calls needed? Currently, all I see is delete [] stringArray;.
EDIT 2: This seems to properly remove the array from memory:
for (int i=0; i < numberOfStrings; i++)
{
[stringArray[i] release];
}
delete [] stringArray;
NSStringpointers. Nothing C++ about it.new" in C or Objective-C? I must be behind the times... while the resulting type is the same,malloc/freeandnew/deletemust be correctly paired.