I'm having difficulty visualising how to solve this.
Currently I have a function that looks up a value inside a table like so:
value = index_table[i];
However **without changing** the above line I'd like to call a function instead with the param i. In effect swapping the index_table for a function.
I have two ideas:
1: Swap the table completely by using a #define to remap the table to a function.
2: Keep the table but for each element in the table (table is not so big) call the function with a corresponding param.
I can not seem to manage for either way currently.
Is one or both of the ideas suitable or I'm I missing something more obvious?
Can someone point me to an example or show me a simple example?
Please remember I can not change value = index_table[i];
It'd be appreciated!!