Question about real_2d_array in alglib using c++
<p>I'm a bit confused about using the setlength() function of real_2d_array in alglib. Below is a code example:</p>

<pre><code>int main() {
    using namespace alglib;
    int s=3, t=5, i, j;
    real_2d_array fmatrix;
    fmatrix.setlength(s,t);
    for(i=0;i&lt;s;i++) {
        for(j=0;j&lt;t;j++) fmatrix[i][j]=i+j;
    }
    for(i=0;i&lt;s;i++) {
        for(j=0;j&lt;t;j++) cout &lt;&lt; fmatrix[i][j] &lt;&lt; "  ";
        cout &lt;&lt; endl;    
    }
    return 0;
}
</code></pre>

<p>Running this, I get (as expected):</p>

<p>0  1  2  3  4</p>

<p>1  2  3  4  5</p>

<p>2  3  4  5  6</p>

<p>But if I switch around s and t in setlength (making it fmatrix.setlength(t,s) ), instead of getting a segmentation fault or something, I get</p>

<p>0  1  2  3  1</p>

<p>1  2  3  4  2</p>

<p>2  3  4  5  6</p>

<p>Does anyone know what's going on here? is the last column (1,2,6) completely random and unspecified?</p>
