[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SM] Code Help Please



PureBytes Links

Trading Reference Links

Dennis:

>> Arrays: SLow[1](0), SHigh[1](0);
>
>You are only providing one slot in your arrays.... the [1]. 
>
>If you want to save 2 values, all initialized to a value of 0, it would
>be:
>Array: SLow[2](0);

No, he was correct.  The array declaration statement specifies the
maximum value of the array index, not the number of elements in the
array.  Here's an example quoted from the TS2Ki reference manual:

    For example, the following statement declares a one-dimensional
    array with a total of 6 elements:

    Array: MyArray[5](0);

    The array called MyArray will have elements 0, 1, 2, 3, 4, and
    5. The elements in this array will start with a value of zero (0).

    The following Array Declaration statement declares a
    3-dimensional array with a total of 726 elements:

    Array: MyBigArray[10, 10, 5](0);

    The array MyBigArray will hold a maximum of 726 elements
    (11x11x6) and all elements will begin with a value of zero (0).

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com