2D Arrays 
Author Message
 2D Arrays

Hi,
I was just wondering how to find out the size of a 2D array when it is
passed as a parameter. How do you find out both the x and y lengths.

Thanks,
Greg



Sat, 25 Jan 2003 03:00:00 GMT  
 2D Arrays

Quote:

> I was just wondering how to find out the size of a 2D array when it is
> passed as a parameter. How do you find out both the x and y lengths.

You can't.  If you need this, you should probably make an array wrapper
class.

Cheers,
-- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Sat, 25 Jan 2003 03:00:00 GMT  
 2D Arrays

Quote:
> Hi,
> I was just wondering how to find out the size of a 2D array when it is
> passed as a parameter. How do you find out both the x and y lengths.

> Thanks,
> Greg

If, for some reason you can't save the dimensions somewhere when you create
it you can make your own function(findDimensions) that repeatedly passes
indexes to another function(ValidIndex) which return true if the indexs are
in the array or false if out; use Exception to determine this in ValidIndex.
Of course finding an efficient algorithm to narrow in on the end of the
array can be tricky. And of course you probably won't need to do this :)
-laz


Sun, 26 Jan 2003 03:00:00 GMT  
 2D Arrays
Doing a simple binary repetition might work well enough, kind of the
opposite of a binary search. The hard part would be knowing what middle
value to start with.

Jeff

Quote:

>> Hi,
>> I was just wondering how to find out the size of a 2D array when it is
>> passed as a parameter. How do you find out both the x and y lengths.

>> Thanks,
>> Greg

>If, for some reason you can't save the dimensions somewhere when you create
>it you can make your own function(findDimensions) that repeatedly passes
>indexes to another function(ValidIndex) which return true if the indexs are
>in the array or false if out; use Exception to determine this in
ValidIndex.
>Of course finding an efficient algorithm to narrow in on the end of the
>array can be tricky. And of course you probably won't need to do this :)
>-laz



Sun, 26 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. creating a new 2D array with two 2D arrays

2. convert 2d array to 1d array without using shift registers and build array

3. 1D binairy array (I16) to 2D array

4. create an array of 2D array

5. Converting Nx15 x1000 3D array to 15by1000*N 2D array

6. Change a 2D Array into a 1D Array.

7. 1d array containing means of a 2d array

8. 2D array to 1D array

9. Numeric 2d Array to 3d Array

10. how to perform operation on each element of 2d array then return 2d array?

11. NB. gray.js: a J verb that generates a grayscale postscript image from a 2d array

12. 2d array problem

 

 
Powered by phpBB® Forum Software