memset能够达到修改覆盖的作用,相当于将前n个字符修改成自己想要的
#include "string.h"
#include "stdio.h"
int main()
{
char arr1[20]="bit";
char arr2[20]="########";
memset( arr1,'*',5);
strcpy(arr2,arr1);
printf("%s\n",arr2);
printf("%d",strlen(arr2));
}
还有长度的变化字符串后面会自带\0
*****
5Press any key to continue