Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

It doesn't exist the way you want it. You would need to implement it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top