fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int max;
  5. void cal(int i){ cout<< max;}
  6.  
  7. int main() {
  8. // your code goes here
  9. cal(1);
  10. return 0;
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void cal(int)’:
prog.cpp:5:25: error: reference to ‘max’ is ambiguous
 void cal(int i){ cout<< max;}
                         ^~~
prog.cpp:4:5: note: candidates are: int max
 int max;
     ^~~
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                 from /usr/include/c++/6/ios:40,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_algobase.h:265:5: note:                 template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/6/bits/stl_algobase.h:219:5: note:                 template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
stdout
Standard output is empty