Get NSArray "row" number using code

Hi


Please excuse me if I got the termonology wrong here.


I have the need ro know the "row" number/index of an array row


I have an array that has two other arrays in it


I know I can access the elements directly using the index as follows


myARRAY[0][0], would give me "row" 1 column 1 etc


How can I find out how many "rows" are in my array so that I can access them using [0][0] and next row [1][0]?


regards


Matt

You should have this information when you first created the 'array' with something like:

float myArray[7][23];


Actually, this is a C array not an Objective-C NSArray.

If you had "an NSArray with two other arrays in it" then you would be using notation like:

float aValue=[[[myArray objectAtIndex:1] objectAtIndex:22]; for myArray[1][22] floatValue];

I'd like to expand./correct what I wrote above.....

you can use

[myArray[0] count]

or

[myArray[1] count]


These are equivalent to [[myArray objectAtIndex:0] count]; which gives you the count in the first array, and the equivalent: [[myArray objectAtIndex:1] count]; which gives you the count in the second array. Your array is actually not a two dimensional array but rather 2 one dimensional arrays. If both of your arrays have equal count, e.g. 7, then your array is a 2x7 two dimensional array.

Get NSArray "row" number using code
 
 
Q