c03: add
This commit is contained in:
parent
69ffe43f1d
commit
d4da57d77b
45
c03/ex00.c
Normal file
45
c03/ex00.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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;
|
||||
}
|
51
c03/ex01.c
Normal file
51
c03/ex01.c
Normal file
@ -0,0 +1,51 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ex00.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/29 19:42:18 by achubuko #+# #+# */
|
||||
/* Updated: 2023/11/29 22:14:59 by achubuko ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <tests.h>
|
||||
#include <stdlib.h>
|
||||
#define TEST_BUF_SIZE 100
|
||||
|
||||
int ft_strncmp(char *s1, char *s2, unsigned int n);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char s[TEST_BUF_SIZE] = "Hello World!";
|
||||
char d1[TEST_BUF_SIZE] = "Hello World!";
|
||||
char d2[TEST_BUF_SIZE] = "Hello Sarld!";
|
||||
char d3[TEST_BUF_SIZE] = "Hell";
|
||||
int r1;
|
||||
int r2;
|
||||
|
||||
printf("initial strings:\n");
|
||||
dump(s, 20);
|
||||
dump(d1, 20);
|
||||
dump(d2, 20);
|
||||
dump(d3, 20);
|
||||
|
||||
printf("strncmp(d2, s, 5):\n");
|
||||
r1 = strncmp(d2, s, 5);
|
||||
r2 = ft_strncmp(d2, s, 5);
|
||||
printf("return values: orig: %i ft: %i\n", r1, r2);
|
||||
printf("strncmp(s, d2, 20):\n");
|
||||
r1 = strncmp(s, d2, 20);
|
||||
r2 = ft_strncmp(s, d2, 20);
|
||||
printf("return values: orig: %i ft: %i\n", r1, r2);
|
||||
printf("strncmp(s, d1, 15):\n");
|
||||
r1 = strncmp(s, d1, 15);
|
||||
r2 = ft_strncmp(s, d1, 15);
|
||||
printf("return values: orig: %i ft: %i\n", r1, r2);
|
||||
printf("strncmp(s, d3, 15):\n");
|
||||
r1 = strncmp(s, d3, 15);
|
||||
r2 = ft_strncmp(s, d3, 15);
|
||||
printf("return values: orig: %i ft: %i\n", r1, r2);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user