int level = read (settings, CS_LEVEL);            

int index, rc = nearest_in (array, length, (int x) [level] {
                                                             return abs (x - level); 
                                                           });
