why I can't use the words min and max as variable names?

后端 未结 3 2037
慢半拍i
慢半拍i 2020-12-22 14:28

In this C++ program the function print_nums doesn\'t accept the vector numbers as an actual prameter when called in the switch

3条回答
  •  半阙折子戏
    2020-12-22 14:59

    You use using namespace std; (get out of that habit) which means that std::min and std::max are pulled in from the std namespace into the global namespace. That is why you can't then use those names in your own code, since they have already been defined.

提交回复
热议问题