c语言使用sort函数要加using namespace std c语言里面没有sort函数,c++里面才有sort函数,sort函数被包含在algorithm的头文件里,使用时还需要加上using namespace std;是因为c++没有使用全局命名空间,sort是std命名空间的函数。