#include "stdafx.h" #include#include using namespace std; int main(int argc, char* argv[]) { string x; const char *y="hello"; const char z[]="hello world"; x=y; cout< 输出
hello 5 hello world 11从结果可以看出char*和char[]可以直接转换为string
string转char#include "stdafx.h" #include#include using namespace std; int main(int argc, char* argv[]) { string x="hello"; const char *y; y=x.data(); cout<


