ajout libft en dure
This commit is contained in:
28
libft/srcs/ft_strcmp.c
Normal file
28
libft/srcs/ft_strcmp.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strcmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2018/11/14 21:16:08 by hulamy #+# #+# */
|
||||
/* Updated: 2019/03/25 15:18:30 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
** compare two null terminated strings and return value
|
||||
** of difference between first two different character
|
||||
*/
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int ft_strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (s1[i] && s1[i] == s2[i])
|
||||
i++;
|
||||
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
|
||||
}
|
||||
Reference in New Issue
Block a user