Another easy way is to create a memory / array for this function. However, this option can be very inefficient.
x must be the input address for the memory, and the value at this location may be the output of the function.
Suppose the meaning of your function is as follows. (This is just an example)
x = 0 => f(0) = 1 x = 1 => f(0) = 2 x = 2 => f(0) = 3 x = 3 => f(0) = 4
So, you can create an array for this that saved the output values.
int a[4] = `{1, 2, 3, 4};
source share