C语言中move语句的用法?说错了,是memmove语句```````````

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 00:26:35
C语言中move语句的用法?说错了,是memmove语句```````````C语言中move语句的用法?说错了,是memmove语句```````````C语言中move语句的用法?说错了,是mem

C语言中move语句的用法?说错了,是memmove语句```````````
C语言中move语句的用法?
说错了,是memmove语句```````````

C语言中move语句的用法?说错了,是memmove语句```````````
void *memmove( void *dest,const void *src,size_t count );
头文件是
此函数将src后面的count个字符,拷贝到dest中.
举个例子:
char string1[60] = "The quick brown dog jumps over the lazy fox";
char string2[60] = "The quick brown fox jumps over the lazy dog";
/* 1 2 3 4 5
* 12345678901234567890123456789012345678901234567890
*/
memcpy( string1 + 16,string1 + 40,3 );
/*
就是string1数组中第40个字符的后面三个字符,替换string1数组中第16个字符后面的三个字符
*/
printf( "Result:%s\n",string1 );
printf( "Length:%d characters\n\n",strlen( string1 ) );
程序得出的结果为:
Result:The quick brown fox jumps over the lazy fox
Length:43 characters
我尽力讲清楚了,!