Re: How to store C Arrays as a Property or iVar?


Jack Brindle
 

Can you publish the actual declarations for myArray and mArray? The ones you show aren’t quite legal and
will be rejected by C compilers.

There isn’t that much different from regular C. In your code, you are not creating a property, but rather an instance variable.
Thus it does not create anything named _mArray. If you created an @property var then the _mArray might work.
Struct assignment does work in Objective C. I don’t remember that arrays may be copied, though. Might that be a C++ extension?

- Jack

On Aug 18, 2017, at 12:07 PM, Dave <dave@...> wrote:

Hi All,

I’ve converted some C code into Objective-C and have some C Array structures like so:

int [10][10]) myArray;

That I want to store in a Property or iVar inside a Wrapper Class. How do I do this?

I’ve tried:


@interface WrapperClass : NSObect
{
int [10][10]) mArray;
}

But I get an error if I try to assign or read it, as in:

myArray = _mArray;

or

_mArray = myArray;


Thanks a lot
All the Best
Dave



Join {cocoa@apple-dev.groups.io to automatically receive all group messages.