Hi all,
If I have an array like this:
const char *demo_names[] = {
PSTR ("Slide Down"),
PSTR ("Slide Up"),
PSTR ("Slide Right"),
PSTR ("Slide Left"),
};
I can do this:
uint8_t string_count = sizeof (demo_names) / sizeof (*demo_names);
...and of course "string count" returns "4".
Now, I want to do the same thing with an array like this:
static const uint8_t font[] PROGMEM = {
0x7c, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x7f, 0x7c,
0x3e, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x3e, // 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, // 1
// ------- snip ------------
};
But "sizeof(font)" returns "2" (the size of a 16 bit pointer I assume?) and of course "sizeof(*font)" returns 1 (the size of each uint8_t element).
Is there a way I can make this work so that if, say, there are 100 bytes of type "uint8_t" I can get "100" as the count and "1" as the byte size?
Said another way, I would expect that if I instead had an array of uint32_t, "sizeof" would return "100 elements" and "4 bytes in each element"
Thanks!
-- Roger