while using the the // function lowerbound ,i am geting output as 21…which is something i did not expect…
my code…
int main()
{
int arr1[] = {10, 15, 20, 25, 30, 35};
printf("%d",lower_bound(arr1, arr1+24,10) - arr1);
return 0;
}
help please-
Read about lower bound here.
Throws if either an element comparison or an operation on an iterator throws.
Note that invalid arguments cause undefined behavior.
Your array size isnt 24, so “arr+24” isnt a valid argument. Replace it with “arr+6” and report the result to us ^^
thanks its correct…got my mistake…
Glad that it helped dear ^^