title: Iterating through elements in an array by memory address. (C)
body: <p>Im new to C. I have a const unsigned short array of 1024 hex numbers. each hex number represents is 8 bits and represents bits to be turned on and off when displaying an image to a GBA screen. But nevermind all that and the DMA syntax I have below just for reference!! </p>
  
  <p>My main question is...how can I iterate through elements in an array BY ADDRESS, grab those contents, then continue incrementing through addresses? Also, if you could give a stare to the below code and maybe see why Im getting:</p>
  
  <pre><code>"Program.c:(.text+0xe8): undefined reference to `myimg'" 
  </code></pre>
  
  <p>on the line that calls "drawImage3" and that would be rad.</p>
  
  <p>(in the main of program.C):</p>
  
  <pre><code>const unsigned short *pt;  
  pt = &amp;myimg[0]; 
  int size = 5;
  drawImage3(15,15,img_WIDTH,img_HEIGHT, pt);
  </code></pre>
  
  <p>(defined elsewhere):</p>
  
  <pre><code>void drawImage3(int x, int y, int width, int height, const u16* image)
  {
      int r;
      for (r=0; r&lt;height; r++)
      {   
          DMA[3].src = &amp;image;
          DMA[3].dst = &amp;videoBuffer[OFFSET(x+width, y, 240)];
          DMA[3].cnt = width | DMA_SOURCE_FIXED | DMA_ON |   DMA_DESTINATION_INCREMENT;  
          image++;    
      }
  }
  </code></pre>