maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_strcat_const.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_strcat_const.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: rocky <marvin@42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2024/09/06 12:15:55 by rocky #+# #+# */
9/* Updated: 2024/09/06 12:15:59 by rocky ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15char *ft_strcat_const(const char *dest, const char *src)
16{
17 int i;
18 int j;
19 char *result;
20
21 result = malloc(sizeof(char) * (ft_strlen(dest) + ft_strlen(src) + 1));
22 if (!result)
23 return (NULL);
24 i = 0;
25 while (dest[i] != '\0')
26 {
27 result[i] = dest[i];
28 i++;
29 }
30 j = 0;
31 while (src[j] != '\0')
32 {
33 result[i + j] = src[j];
34 j++;
35 }
36 result[i + j] = '\0';
37 return (result);
38}
char * ft_strcat_const(const char *dest, const char *src)
size_t ft_strlen(const char *s)
Definition ft_strlen.c:15