title: Accessing elements of typedef'ed array of pointers
body: <p>I'm having some issues accessing elements of an array passed into a function.</p>
  
  <pre><code>#define N (128)
  #define ELEMENTS(10)
  typedef int (*arrayOfNPointers)[N];
  </code></pre>
  
  <p>So, if this is right, it is a data type describing an array of <code>N</code> pointers to <code>int</code>.</p>
  
  <p>I later initialize my arrays individually, like so:</p>
  
  <pre><code>arrayOfNPointers myPtrs = { 0 };
  int i;
  for (i=0; i&lt;N; i++) {
    myPtrs[i] = (int*)malloc(ELEMENTS);
  }
  </code></pre>
  
  <p>However, this fails with the following error:</p>
  
  <pre><code>error: incompatible types when assigning to type 'int[128]' from type 'int *'
  </code></pre>
  
  <p>So, it seems there is something very wrong in my syntax. But in another chunk of code, where I'm modifying the contents of some such structures, I have no problems.   </p>
  
  <pre><code>void doWork(void* input, void* output) {
     int i,m,n;
     arrayOfNPointers* inputData = (arrayOfNPointers*)input;
     int* outputData = (int*)output;
  
     for (m=0, n=0; n&lt;nSamples; n++) {
        for (i=0; i&lt;nGroups; i++) {
           outputData[m++] = (*inputData)[i][n];
        }
     }
  }
  </code></pre>
  
  <p>Is this array logic severely broken?</p>