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

/*	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;
}

你可能感兴趣的:(C语言)