Is there something similar to bsearch built in, that returns the immediately smaller element if the same element is not present and NULL only if the element is already smaller than all other elements. This would require the user to check if the return value's key is same as the function argument, but it would be very useful in its own right. Thanks.
Asked
Active
Viewed 109 times
2 Answers
1
It doesn't exist the way you want it. You would need to implement it.

Shamim Hafiz - MSFT
- 21,454
- 43
- 116
- 176
0
As far as I can say there is no such function in the standard library. But it should not be to hard to do this on your own or find a library.

frast
- 2,700
- 1
- 25
- 34