title: C++/Arduino Passing pointer to 2D array stored in PROGMEM
body: <p>I have several const int 2D arrays globally stored in PROGMEM. for example:</p>
  
  <pre><code>const int image1[][17]PROGMEM = {
    {1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
    {1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
    {1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0},
    {1,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0},
    {1,1,1,0,0,0,1,1,1,0,0,1,1,1,1,0,0}
  }
  </code></pre>
  
  <p>I would like to read out this 2d image array in a function. Which image to read out should be specified in the argument.</p>
  
  <pre><code>void printImage(image)
  {
    // do something with element i,j of image
    pgm_read_byte(image[i][j])
  }
  </code></pre>
  
  <p>I am not very expierenced with the use of pointers etc. but I know that's the way to do it. Can you show me how to make it work?</p>
  
  <p>EDIT1:
  How I do it now (it works, but it is not elegant); I have the function printImage1() without any arguments, and in the body function I use:</p>
  
  <pre><code>pgm_read_byte(&amp;image1[i][j])
  </code></pre>
  
  <p>to read out image1.
  For image2, image3 etc. I copy the function printImage1 and change imgage1 from above to image2, image3 etc. This is redundant programming thats why I want to specify the image in the argumant using only one function printImage.</p>