logo codesdope

if i replace MAX with max code doesnt work. Please tell why


using namespace std;
const int MAX = 5;
class Search{
private:    int count;
int a[MAX];
        int ser(int item);
        void ins(int item);
Search ::Search()
    for(int i=0;i<MAX;i++)
void Search::ins(int item)
    cout<<"Array full \n";
int Search::ser(int item)
    int i;
    return -1;
    return i;
    int main()
        int n;
        Search s;s.ins(1),s.ins(23);s.ins(21);s.ins(22);
        cout<<"\n Enter Item to be Inserted :";
        cout<<"\n Enter Item to be Searched :";
        int i=s.ser(n);
        cout<<"\n Item not found\n";
        cout<<"\n Item found at location "<<i+1;

  • Reason main.cpp:7:11: error: reference to 'max' is ambiguous Token max is also defined at bits\stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    - Druva CH


Write your answer

Welcome.please sign up.


Welcome.please login.