c_piscine__offshore_mains/c03/ex00.c

46 lines
1.6 KiB
C
Raw Normal View History

2023-11-29 18:16:34 +00:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ex00.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/29 19:42:18 by achubuko #+# #+# */
/* Updated: 2023/11/29 22:09:07 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include <tests.h>
#include <stdlib.h>
#define TEST_BUF_SIZE 100
int ft_strcmp(char *s1, char *s2);
int main(void)
{
char s[TEST_BUF_SIZE] = "Hello World!";
char d1[TEST_BUF_SIZE] = "Hello World!";
char d2[TEST_BUF_SIZE] = "Hello Sarld!";
int r1;
int r2;
printf("initial strings:\n");
dump(s, 20);
dump(d1, 20);
dump(d2, 20);
printf("strcmp(d2, s):\n");
r1 = strcmp(d2, s);
r2 = ft_strcmp(d2, s);
printf("return values: orig: %i ft: %i\n", r1, r2);
printf("strcmp(s, d2):\n");
r1 = strcmp(s, d2);
r2 = ft_strcmp(s, d2);
printf("return values: orig: %i ft: %i\n", r1, r2);
printf("strcmp(s, d1):\n");
r1 = strcmp(s, d1);
r2 = ft_strcmp(s, d1);
printf("return values: orig: %i ft: %i\n", r1, r2);
return 0;
}