Can anyone pls tell me how to handle "struct" with the help of
built in "bsearch". i tried with normal tcwin(not vc) help
but failed to handle the search of "string"
pls tell me what can i do 4 searching strings
or even is there any other option which is more efficient
thx in advance.
Bsearch---built in
Moderator: Board moderators
Re: Bsearch---built in
To nikhil
Code: Select all
binary_search() from STL.
Last edited by lnr on Fri Oct 17, 2008 9:01 pm, edited 5 times in total.
Re: Bsearch---built in
Hmm, I doubt that the example in your code would work - the array has to be sorted for binary search.
Re: Bsearch---built in
I am very sorry.
Yes you are absolutely right.
Yes you are absolutely right.
Re: Bsearch---built in
If you're talking about bsearching on an array of structs then you need to have your query in the same kind of struct. Then just customize the compare function for strcmp(), if that's what u r asking.