• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Two dimensional array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two dimensional array


  • Subject: Re: Two dimensional array
  • From: "Tony S. Wu" <email@hidden>
  • Date: Thu, 13 Nov 2003 15:02:02 -0800

basically you create a NSMutableArray to hold other NSArray.
like so:

NSMutableArray *first = [[NSMutableArray alloc] initWithCapacity: 5];
[first insertObject: [NSArray arrayWithObjects: @"a", @"b", @"c", @"d", @"e", nil] atIndex: 0];
[first insertObject: [NSArray arrayWithObjects: @"f", @"g", @"h", @"i", @"j", nil] atIndex: 1];

and so on.
to access items, for example, g, you'd say:

[[first objectAtIndex: 1] objectAtIndex: 1];

Tony S. Wu
email@hidden

"The world doesn't give us hope - it gives us chance."
http://homepage.mac.com/tonyswu/tonyswu - My web page.
------------------------------------------------------------------------ -------



On Nov 13, 2003, at 2:10 PM, Jay Rimalrick wrote:

How do you create a two dimensional static array in objective c?

in c++ I would do this

myArray[5][5] = {a,b,c,d,e},
{f,g,h,i,j},
{k,l,m,n,o},
{p,q,r,s,t}
{u,v,w,x,y};

how can I do this in objective c and how can I access the members?

Thanks in advance,
jay




________________________________________________________________
Sent via the WebMail system at 1st.net
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Two dimensional array (From: "Jay Rimalrick" <email@hidden>)

  • Prev by Date: Re: Two dimensional array
  • Next by Date: Re: Two dimensional array
  • Previous by thread: Re: Two dimensional array
  • Next by thread: Re: Two dimensional array
  • Index(es):
    • Date
    • Thread