主页
C 语言
C 字符串 strncpy() 函数
demo_ref_string_strncpy
运行 ❯
×
更改方向
保存代码
更改主题
#include
#include
int main() { char str1[] = "Hello World!"; char str2[] = "Write code!"; strncpy(str2, str1, 6); printf("%s\n", str1); printf("%s\n", str2); return 0; }
Hello World!
Hello code!