#include <stdio.h>
#include <string.h>
int main()
{
const char* chs = "HELLO WORLDddddddddddddddc";
char temp1[128] = "AAAAAAAAAAAAAAAAAAAAAAAAAAA";
char temp2[128] = "AAAAAAAAAAAAAAAAAAAAAAAAAAA";
// memset(temp, '\0', sizeof(temd));//不初始化了
strncpy(temp1, chs, strlen(chs)+1);//比chs多1个'\0'的字符,有和没有差别很大
printf("%s\n", temp1);
strncpy(temp2, chs, strlen(chs)-1);//比chs多1个'\0'的字符,有和没有差别很大
printf("%s\n", temp2);
return 0;
}