运行 ❯
建立您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <cstring> using namespace std; int main() { char str1[] = "Hello World!"; char str2[] = "Write code!"; strncpy(str2, str1, 6); cout << str1 << "\n"; cout << str2 << "\n"; return 0; }
Hello World!
你好,代码!