Putting array initalizers at the end of my sketch

I have a large number of bitmaps (image data) in the form of arrays. I am placing them at them beginning of my sketch. This makes it hard o read the code, since you have to scroll down several pages to see:
void setup()
void loop()

Is there a way to put the array data at the end of the sketch and initialize the arrays at the beginning of the sketch?

Towards the upper right of the IDE you'll find a downward pointing arrow. Click is and select the New Tab option. When it askes for the file name, put in "bitmaps.h" or something similar. Put all your bitmap arrays in that file. In your main sketch, put

#include "bitmaps.h"

at the top.

hib1:
Is there a way to put the array data at the end of the sketch and initialize the arrays at the beginning of the sketch?

You can put the array declarations at the end of the sketch if that is more convenient for you - but if they contain a lot of code that is not relevant to your main logic then Jiggy-Ninja's suggestion to put then in separate tabs would make sense. Strictly speaking, the preferred way to do that would be to create a .c or .cpp file containing the data definitions and initialisation, and a .h header file containing the external declarations for the data; your other files needing access to the data would #include the header file rather than the .cpp file.

hib1:
I have a large number of bitmaps (image data) in the form of arrays. I am placing them at them beginning of my sketch. This makes it hard o read the code, since you have to scroll down several pages to see:
void setup()
void loop()

Is there a way to put the array data at the end of the sketch and initialize the arrays at the beginning of the sketch?

If these bitmaps are not changing then make the arrays const and put the values right there. That way they will initialize at compile and reside in flash, not RAM.

If these bitmaps are not changing then make the arrays const and put the values right there. That way they will initialize at compile and reside in flash, not RAM.

If you want them in flash, you'll have to qualify with PROGMEM, and you'll have to handle them differently using the appropriate access methods; qualifying as "const" alone won't put them in flash.

Ahhh, I checked some code I used last week and long story short, the compiler and my code teamed up to fool me again!

Yup, PROGMEM is needed!

#include <avr/io.h>
#include <avr/pgmspace.h>

const char PROGMEM textTable[] = { // all this text stored in flash
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n\0"
};

PGM_P tT; // will point into namesTable

// change const char to char and free RAM stays the same.
const char charTable[] = { // this stays in flash too IDE 1.03
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n\0"
};


void  printProgstring( PGM_P FM )
{
  byte fb;
  do 
  {
    fb = pgm_read_byte( FM++ );    
    if ( fb )  Serial.print((char) fb );
  }
  while ( fb );
}


int freeRam () {
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void setup(void)
{
  char *byteme = "0123456789012345678901234567890123456789";
  
  Serial.begin( 9600 );
  Serial.println( byteme );
  Serial.print( "\n Free RAM = " );
  Serial.print( freeRam());
  Serial.println();

  const char *byteyou = "9876543210987654321098765432109876543210";
  Serial.println( byteyou );
  Serial.print( "\n Free RAM = " );
  Serial.print( freeRam());
  Serial.println();

  tT = textTable;
  printProgstring( tT ); 
//    Serial.println( textTable );   
  Serial.println( "\n" );
  
  Serial.println( charTable );   
} 

void loop(void)
{
}