-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_push_char.c
More file actions
26 lines (23 loc) · 1.08 KB
/
ft_push_char.c
File metadata and controls
26 lines (23 loc) · 1.08 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_push_char.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fokrober <fokrober@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/18 23:29:04 by fokrober #+# #+# */
/* Updated: 2019/05/04 15:29:06 by nkhribec ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_push_char(char *s, char c)
{
int i;
i = 0;
while (s[i])
i++;
s[i] = c;
s = (char*)ft_realloc(s, (i + 1) * sizeof(char), (i + 2) * sizeof(char));
s[i + 1] = '\0';
return (s);
}