base struct

This commit is contained in:
gazhonsepaskwa
2025-01-13 13:21:53 +01:00
parent a7e1a55200
commit 09c2cb5b3e
47 changed files with 1835 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/14 10:58:07 by nalebrun #+# #+# */
/* Updated: 2024/11/25 16:16:32 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
size_t i;
unsigned char *ss1;
unsigned char *ss2;
if (!s1 || !s2)
return (0);
i = 0;
ss1 = (unsigned char *)s1;
ss2 = (unsigned char *)s2;
if (n == 0)
return (0);
while (i < n && ss1[i] && ss2[i] && ss1[i] == ss2[i])
i++;
if (i == n)
return (0);
return (ss1[i] - ss2[i]);
}