title: C: Passing pointers: incompatible pointer type warning
body: <p>I'm trying to pass a 2d-array (array of strings) to a function in C, but am running into an "incompatible pointer type" warning.</p>
  
  <pre><code>In function ‘main’:
  warning: passing argument 1 of ‘addCodonstoHash’ from incompatible pointer type
  </code></pre>
  
  <p>Code follows below. I am trying to create a hash table using uthash that will have 3-letter strings as keys (representing DNA codons), and associated char values representing the amino acid that the codon is translated to. So in essence, from the below code, I would want a hash table of the form </p>
  
  <p>{"GCT" : 'A', "GCC" : 'A', "GCA" : 'A', "GCG" : 'A', "GCN" : 'A'}</p>
  
  <p>where 'A' represents Alanine. But right now, I'm having trouble simply passing the array of codons to the function that should parse them and add them to the hash table. I've read through 
  <a href="https://stackoverflow.com/questions/2539844/incompatible-pointer-type">Incompatible pointer type</a>
  and 
  <a href="https://stackoverflow.com/questions/486075/passing-an-array-of-strings-as-parameter-to-a-function-in-c">Passing an array of strings as parameter to a function in C</a>
  to no avail... I <em>thought</em> I understood how arrays are allocated and degrade to pointers, but obviously not. </p>
  
  <p>Furthermore, when I try to compute the length of the array in addCodonstoHash (there are going to be many differently-sized arrays representing the various amino acids), it's returning 8 and 2, respectively, from the printf debug lines, and I can't figure out why this is so. Can you guys steer me in the right direction?</p>
  
  <pre><code>/* Helper method for adding codons to hash table from initialized arrays */
  void addCodonstoHash(char AAarray[][4], char AAname)
  {   int i, size1, size;
      size1 = sizeof(AAarray);
      size  = size1 / sizeof(AAarray[0]);
  
      /* Debugging lines */
      printf("%d\n", size1);
      printf("%d\n\n",size);
  
      for (i = 0; i &lt; (sizeof(AAarray) / sizeof(AAarray[0])); i++)
      {   add_codon(AAarray[i], AAname);
          printf(AAarray[i]);
          printf("\n");
      }
  }
  
  
  int main(int argc, char *argv[])
  {   /*
       * Generate arrays for codons corresponding to each amino acid, will
       * all eventually be incorporated into hash table as keys, with AA
       * values.
       */
      const char Ala[][4] = {"GCT", "GCC", "GCA", "GCG", "GCN"};
      ...
  
  
      addCodonstoHash(Ala, 'A');
  
      delete_all(); 
      return 0;
  }
  </code></pre>
  
  <p>Thanks!</p>