maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_strcat.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_strcat.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: rmikhayl <rmikhayl@student.42london.c +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/12/17 17:25:26 by rmikhayl #+# #+# */
9/* Updated: 2024/06/05 17:16:45 by rmikhayl ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15/* *************************** ft_strcat ************************************ */
16/* Combines two text strings, 'dst' and 'src', ensuring the result fits */
17/* within 'size' characters. Returns the length of the combined text. If */
18/* something's missing or 'size' is too small, undefined behavoiur. */
19/* */
20/* In layman's terms: It's like adding more words to an existing sentence, */
21/* making sure it doesn't get too long. If there's not enough space or */
22/* something is missing, it doesn't work right and doesn't give you the */
23/* correct result. */
24/* ************************************************************************** */
25
26char *ft_strcat(char *dest, char *src)
27{
28 int i;
29 int j;
30
31 i = 0;
32 while (dest[i] != '\0')
33 i++;
34 j = 0;
35 while (src[j] != '\0')
36 {
37 dest[i + j] = src[j];
38 j++;
39 }
40 dest[i + j] = '\0';
41 return (dest);
42}
char * ft_strcat(char *dest, char *src)
Definition ft_strcat.c:26