This commit is contained in:
Timo Schmidt 2023-03-24 02:21:04 +01:00
parent f91dafa6bb
commit 542478f968
1 changed files with 40 additions and 0 deletions

40
ex00/ft_strcmp.c Normal file
View File

@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/17 18:25:06 by tischmid #+# #+# */
/* Updated: 2023/03/24 01:58:29 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s2 && *s1 == *s2)
{
++s1;
++s2;
}
return (*s1 - *s2);
}
/* ////
#include <stdio.h>
#define STR1 "hellb"
#define STR2 "hello"
int main(void)
{
int result;
printf("'%s' VS '%s'\n", STR1, STR2);
result = ft_strcmp(STR1, STR2);
if(!result)
printf("Strings are the same (0)\n");
else
printf("Strings are different (offset=%d)\n", result);
return (0);
}
*/ ////