#include <iostream>
using namespace std;
int main(void)
{
char* p = new char[20];
//p = "abcdef"; (1)
strcpy(p, "abcdef"); // (2)
cout << p << endl;
p[3] = 4;
cout << p << endl;
return 0;
}
为什么最后提示错误
error C2872: cout : ambiguous symbol
如果把#include <iostream>注释掉,又提示错误
error C2871: std : does not exist or is not a namespace
我用的是vc 6.0
我这里运行没有问题的。我也是vc 6.0
你是不是还包含了其它的头文件
如#include <iostream.h>
你可以把using namespace std; 去掉
然后将cout改为std::cout
我的也没有问题,难道是楼主人品问题?
加一个<cstdlib>看看,偶的编译环境也没问题。