Lookup tables are such a common problem. Is there a module in RIOT to handle them?
Are you looking for static or dynamic lookup tables? Static ones I would implement using designated array initializers, provided your keys are integer values.
Like this
const char* table[] = {
[42] = "Zweiundvierzig",
[73] = "Dreiundsiebzig",
// ...
};
const char* translation42 = table[42];
If you do a switch, a smart compiler (there’s a flag for clang) can turn these switches into lookup tables if the compiler decides static tables are faster.