魔教圣女类似的小说:解释C语言语句:momset(word,0,21)?
来源:百度文库 编辑:高校问答 时间:2024/05/04 19:34:04
是memset,word 为数组 这句语句他执行了什么操作,
memset
原型:extern void *memset(void *buffer, int c, int count);
用法:#include <string.h>
功能:把buffer所指内存区域的前count个字节设置成字符c。
说明:返回指向buffer的指针。
举例:
// memset.c
#include <syslib.h>
#include <string.h>
main()
{
char *s="Golden Global View";
clrscr();
memset(s,'G',6);
printf("%s",s);
getchar();
return 0;
}
相关函数:bzero,setmem,strset
memset吧,好像没有momset,也许有我不知道。
memset是用来填充数组的,你的例子:
word:数组名
0:填充数字
21:填充次数。
这句相当于给数组清零。