Skip to content

Commit d0e6fb4

Browse files
committed
task 0: A function that fills memory with a constant byte
1 parent 12ff42f commit d0e6fb4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

0x07-pointers_arrays_strings/0-memset.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
*/
1010
char *_memset(char *s, char b, unsigned int n)
1111
{
12-
while (b >= 0)
12+
unsigned int i;
13+
14+
for (i = 0; i < n; i++)
1315
{
14-
while (n >= 0)
15-
{
16-
(s, b, n);
17-
n++;
18-
_putchar (s);
19-
}
16+
s[i] = b;
2017
}
21-
_putchar ('\n');
18+
2219
return (s);
2320
}

0 commit comments

Comments
 (0)