Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:47:11+00:00 2026-06-18T03:47:11+00:00

I need to use something like a C array: MyStruct theArray[18][18]; but I cannot

  • 0

I need to use something like a C array:

MyStruct theArray[18][18];

but I cannot define it as a property:

@property (nonatomic) MyStruct theArray[18][18];

then I have to:

@implementation MyClass
{
    MyStruct theArray[18][18];
}

But is this good in term of modern Objective C guideline?

Thanks

Update:

I know I can define the struct as class and use NSMutableArray to handle it, but it is more convenient to use the C array in my case, the main concern is coding guideline and memory issue, as I do not allocate or release the theArray[18][18], not sure what its life cycle is, and I’m using ARC.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:47:12+00:00Added an answer on June 18, 2026 at 3:47 am

    Properties cannot be of array type, while public instance variables do not provide sufficient encapsulation. A more Objective C – like approach would be defining a private 2D array, and a pair of methods or a method returning a pointer to access it – something along these lines:

    // For small structs you can use a pair of methods:
    -(MyStruct)getElementAtIndexes:(NSUInteger)i and:(NSUInteger)j;
    -(void)setElementAtIndexes:(NSUInteger)i and:(NSUInteger)j to:(MyStruct)val;
    
    // For larger structs you should use a single method that returns a pointer
    // to avoid copying too much data:
    -(MyStruct*)elementAtIndexes:(NSUInteger)i and:(NSUInteger)j;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use something like get_or_create() but the problem is that I have
So I need to use the webservices of x.com something like https://x.com:1443/services/servicex?wsdl and I
I use apache/passenger on my development machine, but need to add SSL support (something
I need to use something to coordinate my system with several consumers/producers each running
I use edit-in-place plugin: http://arashkarimzadeh.com/jquery/7-editable-jquery-plugin.html I't works Great! I just need something to check
I have installed Matlab r2010a on my computer I need use the function xlsread
Need to use own imaged markers instead built-in pins. I have several questions. 1.
I have recently started programming for the iOS Platform but now I need some
I'm creating a array and need use null values <cfset addLinha[1] = qEspecialidades.especialidade> <cfloop
I am pretty sure that if I use something like this in css #list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.