I have an array and a function that gets a char, this char should stand for a specific index in the array. for example, 'a' stands for index 0, 'b' stands for index 1 'c' stands for index 2...
I don't want to use a switch case!
void func(char ch, object* arr)
{
int index = ch//do something
arr[index]
}
Is there any way to do it without switch case, elegant way that won't take many lines of code.