您的位置:首页 > 其它

C操作内存函数(memset,memcpy,memcmp)

2016-01-28 14:45 357 查看
/*	file name	: memory_func_test.c
author		: zhongjun
description	:memory_func_test demo
data		:20150701
time		:PM 22:57
key(study)	:memory operate
*/

#include <stdio.h>
#include <stdlib.h>

char dst_string[20] = "dst string";
char src_string[10] = "src string";

int main()
{
int cmp_res;
//set the store dst_string memory to 0
memset(dst_string,0,sizeof(dst_string));

memcpy(dst_string,src_string,sizeof(src_string));
printf("dst_string(%s)\n",dst_string);

cmp_res = memcmp(dst_string,src_string,strlen(src_string));
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: