binary_search C++-STL

I want to find whether a given element is present in a array or not using the function binary_search(). But before passing the array as argument, do I need to sort it or will sorting automatically done by the function?

you need to sort it. see more info http://www.cplusplus.com/reference/algorithm/binary_search/