這是我的代碼。此代碼可以運行良好。 但是在「cout < <」Hello World刪除「endl」時,「< < endl;」,不能運行。 This is what I get when delete endl在cout <<「hello」<< endl中刪除endl後,我的C++程序停止工作
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char * name;
char * n = "aaaa";
strcpy(name, n);
cout << name;
cout << "Hello world!" << endl;
return 0;
}
以下是刪除endl的代碼。
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char * name;
char * n = "aaaa";
strcpy(name, n);
cout << name;
cout << "Hello world!";
return 0;
}
請您的文章,而不是給一個鏈接到一個畫面裏面 – Garf365
,複製/粘貼錯誤消息,也許讀了['strcpy'參考(HTTP://en.cppreference .COM/W/C /字符串/字節/ strcpy的)? – juanchopanza