#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<stdlib.h> #include<assert.h> void *my_memset(void *p1, int val, size_t count) { char *dest = (char *)p1; char *ret = dest; while(count--) { *dest = val; dest = dest + 1; } return ret; } int main() { int arr[] = { 1, 3, 5, 6, 8, 9 }; int i = 0; int *ret = my_memset(arr, 1, 16); for (i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) { printf("%d ", *(ret + i)); } system("pause"); return 0; }