Using #include for variables

I'm doing some stuff with an LCD and have generated a bunch of custom characters using the method in the Arduino LiquidCrystal libraray. So now I have 5 or 6 declarations that look like this (except they're all different obviously):

byte example[8]={
   B11111
   B11111
   B11111
   B11111
};

So my question is, instead of having these definitions in my .ino file, can I use something like:

#include "characters.inc"

Where characters.inc is the definitions saved in a notepad file or whatever.
And then just have the #include statement in my code? This way it's not so cluttered in the main.

Yes you can.

I have used this method to some extent. However it may not work under all scenarios in the IDE, that being said, I've had it working in a library.

With a quick test, you have to use .h or .cpp files so the IDE will see it during compilation.

char myArr[] = {
  #include "mydata.h"
};

void setup() {
  Serial.begin( 9600 );
  Serial.print( myArr );
}

void loop() {}
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
0,

Awesome. That worked perfectly. The only thing is that at first it didn't recognize byte as a type, so I had to add #include <Arduino.h> to the top of my header file. Also, not sure if this was completely necessary, but I put the .h file in my sketch folder. Anyway, thanks man.

byte is defined in Arduino.h

To avoid including the header just for byte, you can use unsigned char instead, as that is what byte really is.

Will it use more memory? Or are they both 8 bits?

They are exactly the same thing.

byte is defined as:

typedef unsigned char byte;

so its just an alias to an unsigned char, and yes unsigned char is 8-bits wide.
typedef has other implications, however they are equal in this circumstance.

Good to know. Thanks.