该函数memset用于初始化空间
void* memset(void* dest, int c, size_t count)
{
assert(dest != NULL);
char* pdest = (char*)dest;
while (count--)
{
*pdest++ = c;
}
return dest;
}
int main()
{
int a[10];
memset(a, 0, sizeof(int) * 10);
}
该函数memset用于初始化空间
void* memset(void* dest, int c, size_t count)
{
assert(dest != NULL);
char* pdest = (char*)dest;
while (count--)
{
*pdest++ = c;
}
return dest;
}
int main()
{
int a[10];
memset(a, 0, sizeof(int) * 10);
}