strcmp 用法--字符串库函数<string.h>
memset函数用法 头文件 <string.h>
strcmp
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int main()
{
char arr1[] = "xyd";
char arr2[] = "***************";
strcpy(arr2, arr1);//将arr1里的元素拷贝到arr2里
printf("%s\n", arr2);//实际上把xyd\0四个字符都放进去了,打印结果直接为xyd
return 0;
}
memset
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int main()
{
char arr[] = "hello hello";
memset(arr,'x',5);//把arr数组里前五个元素替换成x
printf("%s\n",arr);
return 0;
}
标签:arr,--,memset,char,xyd,arr2,include,strcmp
From: https://blog.51cto.com/u_16425777/8854626