#include<iostream>
#include<cstring>
int main()
{
std::cout<<std::strlen("puzzled")<<std::endl;
return 0;
}
编译器报错:'strlen' : is not a member of 'std'
但当导入整个命名空间后又可以(using namespace std)
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
cout<<strlen("puzzled")<<endl;
return 0;
}
1.什么原因呢,为什么使用std::strlen都无效呢?
2.另外想问一下,#include包含语句是怎样将C库的变量导入到std中的?