This commit is contained in:
Ladebeze66
2024-01-16 18:01:58 +01:00
parent 5ad918c85c
commit 5ec8268935
32 changed files with 6769 additions and 2776 deletions

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 22:21:26 by fgras-ca #+# #+# */
/* Updated: 2024/01/11 22:23:53 by fgras-ca ### ########.fr */
/* Updated: 2024/01/16 16:46:23 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -59,3 +59,45 @@ char *ft_itoa(int nb)
}
return (dst);
}
int ft_strcmp(const char *s1, const char *s2)
{
while (*s1 && (*s1 == *s2))
{
s1++;
s2++;
}
return (*(const unsigned char *)s1 - *(const unsigned char *)s2);
}
void *ft_memcpy(void *dest, const void *src, size_t n)
{
char *destmov;
char *srcmov;
size_t i;
destmov = (char *)dest;
srcmov = (char *)src;
if (!dest && !src)
return (0);
i = 0;
while (i < n)
{
destmov[i] = srcmov[i];
i++;
}
return (dest);
}
void *ft_memset(void *s, int c, size_t n)
{
size_t i;
i = 0;
while (i < n)
{
*(unsigned char *)(s + i) = (unsigned char)c;
i++;
}
return (s);
}

Binary file not shown.

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 22:22:01 by fgras-ca #+# #+# */
/* Updated: 2024/01/11 22:24:10 by fgras-ca ### ########.fr */
/* Updated: 2024/01/16 13:36:33 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -86,3 +86,19 @@ char *ft_strchr(const char *s, int c)
}
return (0);
}
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
size_t i;
i = 0;
if (n == 0)
{
return (0);
}
while (s1[i] == s2[i] && (s1[i] != '\0' || s2[i] != '\0') && i < (n - 1))
{
i++;
}
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
}

Binary file not shown.