title: How can I iterate a 2 dimensional array via pointers?
body: <p>I have a 20x20 matrix.  I want to extract chunks of data from the matrix.  I have</p>
  
  <pre><code>int theMatrix[20][20] = {};//Full code initializes with #'s
  int *theMatrixPointer = &amp;theMatrix;
  </code></pre>
  
  <p>But then I get a compiler warning saying</p>
  
  <blockquote>
    <p>warning:  initialization from
    incompatible pointer type</p>
  </blockquote>
  
  <p>I went ahead and ran the code and it looks to be moving across the matrix from left to right.  At least in the short run.  The implementation:</p>
  
  <pre><code>//left to right with pointer;
  while(theMatrixPointer)
  {
      int one = 0;
      int two = 0;
      int three = 0;
      int four = 0;
      double currentProduct = 0;
      //int stop = 0;
      for(int i = 0; i &lt; depth; i++)
      {
          /*if(!theMatrixPointer)
          {
              stop = 1;
              break;
          }*/
          int currentValue = *theMatrixPointer++;
          printf("%d\n",currentValue);
          if(i == 0)
          {
              one = currentValue;
          }
          else if (i == 1)
          {
              two = currentValue;
          }
          else if (i == 2)
          {
              three = currentValue;
          }
          else if (i == 3)
          {
              four = currentValue;
          }
      }
      /*if(stop)
          break;*/
      currentProduct = one * (double)two * three * four;
      printf("PRODUCT: %f\n",currentProduct);
      startPoint++;
      theMatrixPointer = startPoint;
  }
  </code></pre>
  
  <p>...breaks over time as the data is garbage (big ints that are not in the matrix).  So, how can I properly iterate this matrix with a pointer?</p>