Re: Length of a multidimensional array

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Imran Koradia (nojunk_at_microsoft.com)
Date: 09/22/04


Date: Wed, 22 Sep 2004 18:22:43 -0400

you'll need to do array1.getupperbound - array1.getlowerbound to get the
length of the array (number of elements) which is what the OP was asking
for.

Imran.

"Abubakar" <Abubakar@discussions.microsoft.com> wrote in message
news:35375D3C-3B46-4877-8AC5-CBCBAA633DDB@microsoft.com...
> oops
>> and array1.getupperbound(0) will give u 3
>
> i meant array1.getupperbound(1) ofcourse
>
> Ab.
>
> "Abubakar" wrote:
>
>> Hi,
>> its really simple:
>> for your array1(5,3)
>> 5 is at your 0 dimension and 3 at 1
>> so writing
>> array1.getupperbound(0) will give u 5
>> and array1.getupperbound(0) will give u 3
>>
>> hope that helps :-)
>> Abubakar.
>> http://joehacker.blogspot.com
>>
>> "OpticTygre" wrote:
>>
>> > If I have a multidimensional array, such as array1(5, 3), and I want to
>> > find
>> > the length of the first section (the 5), can I just use array1.length,
>> > or
>> > would that return 15 (5 * 3) instead of 5? Thanks in advance.
>> >
>> >
>> >



Relevant Pages

  • Re: Problem with a script
    ... a loop there becomes impractical. ... You still have them as uniquely named array indexes... ... writing the code twice will only ... reading your entire code and parsing it in their head, ...
    (comp.lang.php)
  • Re: Problem with a script
    ... Okay, so variables have unique labels, that doesn't mean they still couldn't be handled in a loop. ... You still have them as uniquely named array indexes... ... I believe that for the new guy this code would be readable, and identifying problems should really not be any more difficult with this, plus I think that it actually might save some time to write the actual code from the beginnig, even though it's not at it's final stage, instead of first writing everything spread out, and then rewriting the same code again cleaned. ... If you expect a person to spend an hour reading your entire code and parsing it in their head, you wont get any help and have to solve the problem by yourself. ...
    (comp.lang.php)
  • Re: problem reading/writing structures from and to files
    ... My progam can write the Data array into a binary file, after writing ... FILE *somefile; ... although the initial fwrite() -- writing bytes ...
    (comp.lang.c)
  • Re: Read and re-write file with one open?
    ... This opens a file for reading and writing, reads the file into an array, ... altered data back to the file, and the file contains half altered data ...
    (comp.lang.ruby)
  • Re: Streams
    ... I'm writing from an Array directly to a Flash Drive. ... So, by writing the array to a stream, compressing from the stream straight ...
    (alt.comp.lang.borland-delphi)