c_piscine__offshore_mains/c02/ex00.c

26 lines
735 B
C
Raw Normal View History

2023-11-23 18:26:57 +00:00
#include "common.c"
2023-11-22 21:34:57 +00:00
char *ft_strcpy(char *dest, char *src);
2023-11-23 18:26:57 +00:00
int main(void)
2023-11-22 21:34:57 +00:00
{
2023-11-23 18:26:57 +00:00
char s1[100] = TEST_SOURCE;
char d1[100] = TEST_DESTINATION;
char s2[100] = TEST_SOURCE;
char d2[100] = TEST_DESTINATION;
char* r1, *r2;
2023-11-22 21:34:57 +00:00
2023-11-23 18:26:57 +00:00
printf("initial strings:\n");
dump(s1, TEST_SOURCE_LENGHT);
dump(d1, TEST_DESTINATION_LENGHT);
r1 = strcpy(d1 ,s1);
printf("strcpy:\n");
dump(s1, TEST_SOURCE_LENGHT);
dump(d1, TEST_DESTINATION_LENGHT);
r2 = ft_strcpy(d2, s2);
printf("ft_strcpy:\n");
dump(s2, TEST_SOURCE_LENGHT);
dump(d2, TEST_DESTINATION_LENGHT);
printf("buffers comparison: s:%i d:%i\n", bufcmp(s1, s2, TEST_SOURCE_LENGHT), bufcmp(d1, d2, TEST_DESTINATION_LENGHT));
printf("return values comparison: %li %li", d1 - r1, d2 - r2);
2023-11-22 21:34:57 +00:00
}