title: pointer array equivalence in C using arrays of different dimensions
body: <p>I've looked at other questions and they don't seem to answer this issue.</p>
  
  <p>I have a routine that I'd like to process an integer array which may be one dimensional or two dimensional</p>
  
  <p>so:</p>
  
  <pre><code>int myarray[10];
  </code></pre>
  
  <p>or</p>
  
  <pre><code>int myarray[10][10];
  </code></pre>
  
  
  
  <pre><code>void myroutine(int *input_array, int num_dimens)
  {
     int digits;
     int limbs;
     int i, j;
  
     digits = get_num_digits();
     if (num_dimens == 1)
     {
        for(i=0; i&lt; digits; i++)
           myprocess(*(input_array+i));
     } else { /* 2 dimensions */
        limbs = get_num_limbs();
        for(j=0;j&lt;limbs;j++)
           for(i=0; i&lt; digits; i++)
             myprocess(*(input_array+j*digits+i));
     }
  }
  </code></pre>
  
  <p>How do I call <em>myroutine</em>?</p>
  
  <pre><code>myroutine(myarray, 1);
  myroutine(myarray2, 2);
  </code></pre>
  
  <p>This does not seem to work.
  NEW EDIT:  Tried to flesh out the example further.</p>