How to set configuration parameters using an array table?
<p>Following situation: I have an array with some constant values, which represent ranges.<br>
A range is always between two values in the array, e.g.: 10 - 20 = range1<br>
20-30 = range2 and so on...</p>

<pre><code>const int arr[] = {10, 20, 30, 40, 50, 60};
</code></pre>

<p>With a Search function, I search for the number(val) between those ranges in arr[] and return the range index where val was found.<br>
For example: if val = 15 → return value would be 1<br>
             if val = 33 → return value would be 3</p>

<pre><code>int Search(const int arr[], int n, int val)
{
    int i = 0;

    while (i &lt; n) {
        if (val &gt; arr[i])
            ++i;
        else
            return i;
    }
    return -1;
}
</code></pre>

<p>OK, this works out so far...</p>

<p>Now following problem:
I have some parameters let's call them x, y, z which are simple integers and they depend on the value of val.
The parameter values for x, y, z I know already before compilation, of course they are different for every range.<br>
How can I now set x, y and z using the range index?
How can I make an array for example with the constant parameter values for x, y, z and set them depending on the returned range index? Or should it be a struct?
How would that look like...?</p>

<p>Thx</p>
