How can I pass the pointer of a static 2D array to a structure/class?
<p>I have a problem when I try to pass the pointer of an array (which contains parameters needed by some functions in my program) to a structure, which then should be passed to those functions. GSL for example wants me to pass parameters in this way.</p>

<p>A little example program looks like this:</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

struct myparams
{
    double  * a;
    double ** b;
};

int main()
{
    double c[10]   = {0,1,2,3,4,5,6,7,8,9};
    double d[4][3] = {{1,2,3},{4,5,6},{7,8,9},{10,11,12}};

    double** e = new double*[4];
    for (int i = 0; i &lt; 4; i++) {
       e[i] = new double[3];
    }

    myparams params;

    // THIS WORKS:
    params.a = c;
    for (int i = 0; i &lt; 10; i++) {
        cout &lt;&lt; params.a[i] &lt;&lt; endl;
    }

    // THIS DOESN'T WORK
    params.b = d;

    // THIS WORKS:
    params.b = e;

    delete[] e;
}
</code></pre>

<p>What is the problem with</p>

<pre><code> params.b = d
</code></pre>

<p>The Compiler complains with <code>"cannot convert 'double[4][3]' to 'double**' in assignment"</code> or something like that (translated from german).</p>
