14 lines
221 B
C
14 lines
221 B
C
|
|
#include <stddef.h>
|
||
|
|
|
||
|
|
void *memset(void *str, int c, size_t n)
|
||
|
|
{
|
||
|
|
unsigned char val = (unsigned char)c;
|
||
|
|
unsigned char *buf = str;
|
||
|
|
|
||
|
|
for (size_t i = 0; i < n; i++) {
|
||
|
|
buf[i] = val;
|
||
|
|
}
|
||
|
|
|
||
|
|
return str;
|
||
|
|
}
|