#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void my_memset(void *str, char n, size_t count)
{
char *dest = (char *)str;
size_t i = 0;
for (i = 0; i < count; i++)
{
*(dest + i) = n;
}
}
int main()
{
int arr[] = { 1, 2, 3, 4, 5, 6 };
my_memset(arr, 0, 16);
int i = 0;
for (; i < 6; i++)
{
printf("%d ", arr[i]);
}
system("pause");
return 0;
}
【C语言】【笔试题】模拟实现memset
最新推荐文章于 2022-10-06 14:20:12 发布