Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Element 0 in arrays
#4
(09-18-2023, 07:14 AM)RhoSigma Wrote:
(09-18-2023, 06:35 AM)PhilOfPerth Wrote: Should it be (or is it already) mentioned in the Wiki,  that Dim var(num of elements) allows element 0, as well as the number of elements dimmed ?
So Dim var(10) actually allocates 11 element positions, not 10. (Or does it)?

This may become significant for memory usage with multi-dimensional arrays:
Dim var(10, 1000) would occupy space for about 11 * 1001 units (11011), not 10000 as I would expect.

It's mentioned already in the first two lines in the Wiki description:
https://qb64phoenix.com/qb64wiki/index.p...escription

Zero is the default for lowest index, to override use OPTION BASE 1 before DIMing your arrays or hard index your arrays using the DIM xxx(lb TO ub) syntax (see Wiki Example 4).

Sorry, missed it!   Blush
Thanks for the reply
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
Element 0 in arrays - by PhilOfPerth - 09-18-2023, 06:35 AM
RE: Element 0 in arrays - by RhoSigma - 09-18-2023, 07:14 AM
RE: Element 0 in arrays - by PhilOfPerth - 09-18-2023, 11:17 AM
RE: Element 0 in arrays - by SMcNeill - 09-18-2023, 07:40 AM
RE: Element 0 in arrays - by RhoSigma - 09-18-2023, 12:58 PM
RE: Element 0 in arrays - by a740g - 09-18-2023, 01:40 PM
RE: Element 0 in arrays - by RhoSigma - 09-18-2023, 02:05 PM
RE: Element 0 in arrays - by mnrvovrfc - 09-18-2023, 02:31 PM
RE: Element 0 in arrays - by PhilOfPerth - 09-19-2023, 06:36 AM



Users browsing this thread: 2 Guest(s)