Automatic add

This commit is contained in:
Timo Schmidt 2023-03-28 15:25:20 +02:00
parent 78df919e7e
commit 41aafb6937
40 changed files with 0 additions and 527 deletions

View File

@ -1,29 +0,0 @@
#include <stdio.h>
int main(void)
{
printf("Expected:%c\nActual:", 'a');
fflush(stdout);
ft_putchar('a');
printf("\nExpected:%c\nActual:", 'b');
fflush(stdout);
ft_putchar('b');
printf("\nExpected:%c\nActual:", 'c');
fflush(stdout);
ft_putchar('c');
printf("\nExpected:%c\nActual:", 'd');
fflush(stdout);
ft_putchar('d');
printf("\nExpected:%c\nActual:", '@');
fflush(stdout);
ft_putchar('@');
printf("\nExpected:%c\nActual:", '~');
fflush(stdout);
ft_putchar('~');
printf("\nExpected:%c\nActual:", ' ');
fflush(stdout);
ft_putchar(' ');
printf("\n");
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_alphabet();
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_reverse_alphabet();
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_numbers();
return (0);
}

View File

@ -1,7 +0,0 @@
int main(void)
{
ft_is_negative(5);
ft_is_negative(0);
ft_is_negative(-5);
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_comb();
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_comb2();
return (0);
}

View File

@ -1,11 +0,0 @@
int main(void)
{
ft_putnbr(-2147483648);
// ft_putnbr(-10000);
// ft_putnbr(-1);
// ft_putnbr(0);
// ft_putnbr(1);
// ft_putnbr(10000);
// ft_putnbr(2147483647);
return (0);
}

View File

@ -1,5 +0,0 @@
int main(void)
{
ft_print_combn(5);
return (0);
}

View File

@ -1,10 +0,0 @@
#include <stdio.h>
int main(void)
{
int nbr[] = {13};
ft_ft(nbr);
printf("%d\n", *nbr);
return (0);
}

View File

@ -1,48 +0,0 @@
#include <stdio.h>
int main(void)
{
int *********ptr;
int p0;
int *p1;
int **p2;
int ***p3;
int ****p4;
int *****p5;
int ******p6;
int *******p7;
int ********p8;
p0 = 7;
p1 = &p0;
p2 = &p1;
p3 = &p2;
p4 = &p3;
p5 = &p4;
p6 = &p5;
p7 = &p6;
p8 = &p7;
ptr = &p8;
printf("%p\n", &ptr);
printf("%p\n", ptr);
printf("%p\n", *ptr);
printf("%p\n", **ptr);
printf("%p\n", ***ptr);
printf("%p\n", ****ptr);
printf("%p\n", *****ptr);
printf("%p\n", ******ptr);
printf("%p\n", ********ptr);
printf("%d\n", *********ptr);
ft_ultimate_ft(ptr);
printf("%p\n", &ptr);
printf("%p\n", ptr);
printf("%p\n", *ptr);
printf("%p\n", **ptr);
printf("%p\n", ***ptr);
printf("%p\n", ****ptr);
printf("%p\n", *****ptr);
printf("%p\n", ******ptr);
printf("%p\n", ********ptr);
printf("%d\n", *********ptr);
return (0);
}

View File

@ -1,14 +0,0 @@
#include <stdio.h>
int main(void)
{
int a;
int b;
a = 1;
b = 2;
printf("%d, %d\n", a, b);
ft_swap(&a, &b);
printf("%d, %d\n", a, b);
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
int main(void)
{
int div;
int mod;
ft_div_mod(10, 3, &div, &mod);
printf("div %d mod %d\n", div, mod);
return (0);
}

View File

@ -1,14 +0,0 @@
#include <stdio.h>
int main(void)
{
int a;
int b;
a = 10;
b = 3;
printf("a %d b %d\n", a, b);
ft_ultimate_div_mod(&a, &b);
printf("div %d mod %d\n", a, b);
return (0);
}

View File

@ -1,7 +0,0 @@
#include <stdio.h>
int main(void)
{
ft_putstr("Hello World\n");
return (0);
}

View File

@ -1,7 +0,0 @@
#include <stdio.h>
int main(void)
{
printf("%d\n", ft_strlen("HELLO WORLD"));
return (0);
}

View File

@ -1,23 +0,0 @@
#include <stdio.h>
int main(void)
{
int i;
int arrlen = 9;
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
i = -1;
while (++i < arrlen - 1)
{
printf("%d, ", arr[i]);
}
printf("%d\n", arr[i]);
ft_rev_int_tab(arr, arrlen);
i = -1;
while (++i < arrlen - 1)
{
printf("%d, ", arr[i]);
}
printf("%d\n", arr[i]);
return (0);
}

View File

@ -1,24 +0,0 @@
#include <stdio.h>
void print_int_arr(int *arr, int arrlen)
{
int i;
i = -1;
while (++i < arrlen - 1)
{
printf("%d, ", arr[i]);
}
printf("%d\n", arr[i]);
}
int main(void)
{
int arrlen = 19;
int arr[] = {1, 6, 7, 8, 8, 77, 63, 3, 64, 51, 5, 53, 65, 67, 7, 8, 68, 99, 9};
print_int_arr(arr, arrlen);
ft_sort_int_tab(arr, arrlen);
print_int_arr(arr, arrlen);
return (0);
}

View File

@ -1,21 +0,0 @@
#include <stdio.h>
#define BUFSIZE 10
#define STR "||||||||||"
int main(void)
{
int arrlen = 4;
char *teststrings[] = {"", "h", "he", "hey"};
char buf[BUFSIZE] = STR;
char *return_val;
for (int j = 0; j < arrlen; ++j)
{
printf("####### dest = '|' * 10, src == '%s' #######\n", teststrings[j]);
return_val = ft_strcpy(buf, teststrings[j]);
printf("RetVal: %s\n", return_val);
for (int i = 0; i < BUFSIZE; ++i)
printf((buf[i] >= 32 && buf[i] <= 126) ? "%c\n" : "0x%x\n", buf[i]);
}
return (0);
}

View File

@ -1,17 +0,0 @@
#include <stdio.h>
#define BUFSIZE 10
#define STR "||||||||||"
int main(void)
{
char buf[BUFSIZE] = STR;
for (int j = 0; j < 11; ++j)
{
printf("####### Dest = '|' * 10, src = 'Hey', Size == %d #######\n", j);
ft_strncpy(buf, "Hey", j);
for (int i = 0; i < BUFSIZE; ++i)
printf((buf[i] >= 32 && buf[i] <= 126) ? "%c\n" : "0x%x\n", buf[i]);
}
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "abcdefg"
int main(void)
{
if (ft_str_is_alpha(STR1))
printf(STR1 " contains only alphabetical characters\n");
else
printf(STR1 " contains non-alphabetical characters\n");
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "0123456789"
int main(void)
{
if (ft_str_is_numeric(STR1))
printf(STR1 " is numeric\n");
else
printf(STR1 " is not numeric\n");
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "abcd"
int main(void)
{
if (ft_str_is_lowercase(STR1))
printf(STR1 " is all lowercase\n");
else
printf(STR1 " contains non-lowercase characters\n");
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "ABCDEF"
int main(void)
{
if (ft_str_is_uppercase(STR1))
printf(STR1 " is all uppercase\n");
else
printf(STR1 " contains non-uppercase characters\n");
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "BCDEF ~~~ "
int main(void)
{
if (ft_str_is_printable(STR1))
printf(STR1 " is printable\n");
else
printf(STR1 " is not printable\n");
return (0);
}

View File

@ -1,10 +0,0 @@
#include <stdio.h>
#define STR "hello world"
int main(void)
{
char s1[] = STR;
printf("%s\n", s1);
printf("%s\n", ft_strupcase(s1));
return (0);
}

View File

@ -1,10 +0,0 @@
#include <stdio.h>
#define STR "hEllO worLd"
int main(void)
{
char s1[] = STR;
printf("%s\n", s1);
printf("%s\n", ft_strlowcase(s1));
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR "salut, com0123456789ment tu vas ? 42" \
"mots quArAnAe-deux; cinquante+et+un"
int main(void)
{
printf(STR "\n");
char s1[] = STR;
printf("%s\n", ft_strcapitalize(s1));
return (0);
}

View File

@ -1,18 +0,0 @@
#include <stdio.h>
#define BUFSIZE 10
int main(void)
{
char buf[BUFSIZE] = "||||||||||";
unsigned int return_size;
for (int j = 0; j < 11; ++j)
{
printf("####### Size == %d #######\n", j);
return_size = ft_strlcpy(buf, "01234", j);
printf("Return Size: %d\n", return_size);
for (int i = 0; i < BUFSIZE; ++i)
printf((buf[i] >= 32 && buf[i] <= 126) ? "%c\n" : "0x%x\n", buf[i]);
}
return (0);
}

View File

@ -1,14 +0,0 @@
#include <stdio.h>
#define BUFSIZE 256
int main(void)
{
char s1[BUFSIZE];
for (int i = -128; i < 127; ++i)
{
s1[i + 128] = i ? i : 1;
}
ft_putstr_non_printable(s1);
return (0);
}

View File

@ -1,24 +0,0 @@
#include <stdio.h>
#define STR "\x42\x6f\x6e\x6a\x6f\x75\x72\x20\x6c\x65" \
"\x73\x20\x61\x6d\x69\x6e\x63\x68\x65\x73" \
"\x09\x0a\x09\x63\x07\x20\x65\x73\x74\x20" \
"\x66\x6f\x75\x09\x74\x6f\x75\x74\x09\x63" \
"\x65\x20\x71\x75\x20\x6f\x6e\x20\x70\x65" \
"\x75\x74\x20\x66\x61\x69\x72\x65\x20\x61" \
"\x76\x65\x63\x09\x0a\x09\x70\x72\x69\x6e" \
"\x74\x5f\x6d\x65\x6d\x6f\x72\x79\x0a\x0a" \
"\x0a\x09\x6c\x6f\x6c\x2e\x6c\x6f\x6c\x0a" \
"\x20\xff\x00"
#define STR2 "HELLO"
int main(void)
{
char *ptr = STR;
for (int i = 0; i < 95; ++i)
{
printf("Bytes: %d\n", i);
ft_print_memory(ptr, i);
write(1, "\n", 1);
}
return (0);
}

View File

@ -1,16 +0,0 @@
#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);
}

View File

@ -1,17 +0,0 @@
#include <stdio.h>
#define STR1 "abd"
#define STR2 "abc"
#define LENGTH 3
int main(void)
{
int result;
printf("'%s' VS '%s' length %d\n", STR1, STR2, LENGTH);
result = ft_strncmp(STR1, STR2, LENGTH);
if(!result)
printf("Strings are the same (0)\n");
else
printf("Strings are different (offset=%d)\n", result);
return (0);
}

View File

@ -1,13 +0,0 @@
#include <stdio.h>
#define STR1 ""
#define STR2 "a"
int main(void)
{
char s1[] = STR1;
char s2[] = STR2;
printf("s1: %s s2: %s\n", s1, s2);
ft_strcat(s1, s2);
printf("s1: %s s2: %s\n", s1, s2);
return (0);
}

View File

@ -1,15 +0,0 @@
#include <stdio.h>
#define STR1 "0123"
#define STR2 "abc"
#define LENGTH 2
int main(void)
{
char s1[] = STR1;
char s2[] = STR2;
printf("Length: %d\n", LENGTH);
printf("s1: %s s2: %s\n", s1, s2);
ft_strncat(s1, s2, LENGTH);
printf("s1: %s s2: %s\n", s1, s2);
return (0);
}

View File

@ -1,11 +0,0 @@
#include <stdio.h>
#define STR1 "hello"
#define STR2 "aa"
int main(void)
{
printf("String to search in: %s\n", STR1);
printf("String to find: %s\n", STR2);
printf("Result: %s\n", ft_strstr(STR1, STR2));
return (0);
}

View File

@ -1,10 +0,0 @@
#include <stdio.h>
int main(void)
{
char s[10] = "123";
printf("%d\n", ft_strlcat(s, "abc", 5));
printf("%s\n", s);
return (0);
}

View File

@ -1,9 +0,0 @@
#include <stdio.h>
int main(void)
{
char str[10] = "Hello";
printf("%d\n", ft_strlen(str));
return (0);
}

View File

@ -1,4 +0,0 @@
int main(void)
{
ft_putstr("HELLO WORLD\n");
}

View File

@ -1,17 +0,0 @@
int main(void)
{
ft_putnbr(INT_MIN);
write(1, "\n", 1);
ft_putnbr(-12);
write(1, "\n", 1);
ft_putnbr(-1);
write(1, "\n", 1);
ft_putnbr(0);
write(1, "\n", 1);
ft_putnbr(1);
write(1, "\n", 1);
ft_putnbr(12);
write(1, "\n", 1);
ft_putnbr(INT_MAX);
write(1, "\n", 1);
}