Felicitations fellow malefactors,
I am writing the elements of an array to an OLED display like:
char *keys[] = {"Am", "A#m", "Bm", "Cm", "C#m", "Dm", "D#m", "Em", "Fm", "F#m", "Gm", "G#m"};
display.setCursor(32, 0);
display.println(keys[keySelect()]);
The elements of the array are musical keys. The elements are indexed by keySelect() (which is a function that reads a potentiometer and returns an integer from 0-11).
This works, but I was wondering if this is "bad form", i.e., using a function as an indexer like that.
Also, I don't know why
char *keys[] = {"Am", "A#m", "Bm", "Cm", "C#m", "Dm", "D#m", "Em", "Fm", "F#m", "Gm", "G#m"}; works.
While
char keys[] = {"Am", "A#m", "Bm", "Cm", "C#m", "Dm", "D#m", "Em", "Fm", "F#m", "Gm", "G#m"};
does not.
Sincere thanks for any advise.
TonyA