Changing the parsing to be traited in string and not in char
This commit is contained in:
parent
8941f67cf1
commit
70c9c5aac1
8 changed files with 161 additions and 299 deletions
31
libft/ft_strcmp.c
Normal file
31
libft/ft_strcmp.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strncmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/07 16:56:56 by rparodi #+# #+# */
|
||||
/* Updated: 2024/03/31 19:51:17 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/minishell.h"
|
||||
|
||||
int ft_strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
size_t i;
|
||||
int diff;
|
||||
|
||||
i = 0;
|
||||
while ((s1[i] || s2[i]))
|
||||
{
|
||||
if (s1[i] != s2[i])
|
||||
{
|
||||
diff = (unsigned char)s1[i] - (unsigned char)s2[i];
|
||||
return (diff);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue