Re: Two dimensional array
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.