-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_padding.c
executable file
·32 lines (29 loc) · 1.13 KB
/
ft_padding.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_padding.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <akharrou@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/18 07:40:24 by akharrou #+# #+# */
/* Updated: 2019/05/02 18:03:11 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/stdlib_42.h"
char *ft_padding(int size, char c)
{
char *buf;
int i;
buf = NULL;
if (size > 0)
{
buf = malloc(size + 1);
if (!buf)
return (NULL);
i = 0;
while (size > i)
buf[i++] = c;
buf[i++] = '\0';
}
return (buf);
}