-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
23 lines (21 loc) · 1.12 KB
/
utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fsandel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/26 17:58:24 by fsandel #+# #+# */
/* Updated: 2023/05/26 18:09:22 by fsandel ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <string.h>
char *strjoin(char *f, char *s) {
int len_f = strlen(f);
char *joined = calloc(len_f + strlen(s) + 1, sizeof(char));
if (!joined) return (NULL);
strcpy(joined, f);
strcat(joined, s);
return (joined);
}