ex00
This commit is contained in:
parent
f91dafa6bb
commit
542478f968
|
@ -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);
|
||||
}
|
||||
*/ ////
|
Loading…
Reference in New Issue