Browse Source

Redo repo as a single repo instead of as nine.

master
masonbee 2 months ago
commit
7c42396e23
  1. BIN
      42 projects/c00.pdf
  2. BIN
      42 projects/c01.pdf
  3. BIN
      42 projects/c02.pdf
  4. BIN
      42 projects/c03.pdf
  5. BIN
      42 projects/c04.pdf
  6. BIN
      42 projects/c05.pdf
  7. BIN
      42 projects/c06.pdf
  8. BIN
      42 projects/c07.pdf
  9. BIN
      42 projects/c08.pdf
  10. BIN
      42 projects/c09.pdf
  11. BIN
      42 projects/c10.pdf
  12. BIN
      42 projects/c11.pdf
  13. BIN
      42 projects/c12.pdf
  14. BIN
      42 projects/c13.pdf
  15. 1
      42 projects/pt.videos.version
  16. BIN
      42 projects/resources.tar.gz
  17. BIN
      42 projects/shell00.pdf
  18. BIN
      42 projects/shell01.pdf
  19. 25
      42 projects/video links.rtf
  20. BIN
      c00/c00.pdf
  21. 18
      c00/ex00/ft_putchar.c
  22. 25
      c00/ex01/ft_print_alphabet.c
  23. 25
      c00/ex02/ft_print_reverse_alphabet.c
  24. 25
      c00/ex03/ft_print_numbers.c
  25. 29
      c00/ex04/ft_is_negative.c
  26. 61
      c00/ex05/ft_print_comb.c
  27. 45
      c00/ex06/ft_print_comb2.c
  28. 55
      c00/ex07/ft_putnbr.c
  29. 37
      c00/ex08/ft_print_combn.c
  30. BIN
      c01/c01.pdf
  31. 16
      c01/ex00/ft_ft.c
  32. 16
      c01/ex01/ft_ultimate_ft.c
  33. 20
      c01/ex02/ft_swap.c
  34. 17
      c01/ex03/ft_div_mod.c
  35. 20
      c01/ex04/ft_ultimate_div_mod.c
  36. 27
      c01/ex05/ft_putstr.c
  37. 24
      c01/ex06/ft_strlen.c
  38. 30
      c01/ex07/ft_rev_int_tab.c
  39. BIN
      c01/ex08/.ft_sort_int_tab.c.swp
  40. 37
      c01/ex08/ft_sort_int_tab.c
  41. BIN
      c02/c02.pdf
  42. 25
      c02/ex00/ft_strcpy.c
  43. 29
      c02/ex01/ft_strncpy.c
  44. 33
      c02/ex02/ft_str_is_alpha.c
  45. 33
      c02/ex03/ft_str_is_numeric.c
  46. 29
      c02/ex04/ft_str_is_lowercase.c
  47. 29
      c02/ex05/ft_str_is_uppercase.c
  48. 29
      c02/ex06/ft_str_is_printable.c
  49. 27
      c02/ex07/ft_strupcase.c
  50. 27
      c02/ex08/ft_strlowcase.c
  51. 55
      c02/ex09/ft_strcapitalize.c
  52. 32
      c02/ex10/ft_strlcpy.c
  53. 54
      c02/ex11/ft_putstr_non_printable.c
  54. BIN
      c03/c03.pdf
  55. 21
      c03/ex00/ft_strcmp.c
  56. 23
      c03/ex01/ft_strncmp.c
  57. 32
      c03/ex02/ft_strcat.c
  58. 32
      c03/ex03/ft_strncat.c
  59. 42
      c03/ex04/ft_strstr.c
  60. 31
      c03/ex05/ft_strlcat.c
  61. BIN
      c04/c04.pdf
  62. 21
      c04/ex00/ft_strlen.c
  63. 30
      c04/ex01/ft_putstr.c
  64. BIN
      c04/ex02/.DS_Store
  65. 56
      c04/ex02/ft_putnbr.c
  66. 37
      c04/ex03/ft_atoi.c
  67. BIN
      c04/ex04/.DS_Store
  68. 99
      c04/ex04/ft_putnbr_base.c
  69. 140
      c04/ex05/ft_atoi_base.c
  70. BIN
      c05/c05.pdf
  71. 30
      c05/ex00/ft_iterative_factorial.c
  72. 25
      c05/ex01/ft_recursive_factorial.c
  73. 30
      c05/ex02/ft_iterative_power.c
  74. 27
      c05/ex03/ft_recursive_power.c
  75. 24
      c05/ex04/ft_fibonacci.c
  76. 33
      c05/ex05/ft_sqrt.c
  77. 36
      c05/ex06/ft_is_prime.c
  78. 35
      c05/ex07/ft_find_next_prime.c
  79. BIN
      c06/a.out
  80. BIN
      c06/c06.pdf
  81. 33
      c06/ex00/ft_print_program_name.c
  82. 40
      c06/ex01/ft_print_params.c
  83. 43
      c06/ex02/ft_rev_params.c
  84. 76
      c06/ex03/ft_sort_params.c
  85. 28
      c06/ft_print_program_name.c
  86. BIN
      c07/c07.pdf
  87. 32
      c07/ex00/ft_strdup.c
  88. 39
      c07/ex01/ft_range.c
  89. 38
      c07/ex02/ft_ultimate_range.c
  90. 89
      c07/ex03/ft_strjoin.c
  91. BIN
      c08/c08.pdf
  92. 22
      c08/ex00/ft.h
  93. 26
      c08/ex01/ft_boolean.h
  94. 18
      c08/ex02/ft_abs.h
  95. 24
      c08/ex03/ft_point.h
  96. BIN
      c08/ex04/.ft_strs_to_tab.c.swp
  97. 70
      c08/ex04/ft_strs_to_tab.c
  98. 86
      c08/ex05/ft_show_tab.c
  99. 1
      shell00/ex00/z
  100. BIN
      shell00/ex01/testShell00.tar
  101. Some files were not shown because too many files have changed in this diff Show More

BIN
42 projects/c00.pdf

Binary file not shown.

BIN
42 projects/c01.pdf

Binary file not shown.

BIN
42 projects/c02.pdf

Binary file not shown.

BIN
42 projects/c03.pdf

Binary file not shown.

BIN
42 projects/c04.pdf

Binary file not shown.

BIN
42 projects/c05.pdf

Binary file not shown.

BIN
42 projects/c06.pdf

Binary file not shown.

BIN
42 projects/c07.pdf

Binary file not shown.

BIN
42 projects/c08.pdf

Binary file not shown.

BIN
42 projects/c09.pdf

Binary file not shown.

BIN
42 projects/c10.pdf

Binary file not shown.

BIN
42 projects/c11.pdf

Binary file not shown.

BIN
42 projects/c12.pdf

Binary file not shown.

BIN
42 projects/c13.pdf

Binary file not shown.

1
42 projects/pt.videos.version

@ -0,0 +1 @@
1

BIN
42 projects/resources.tar.gz

Binary file not shown.

BIN
42 projects/shell00.pdf

Binary file not shown.

BIN
42 projects/shell01.pdf

Binary file not shown.

25
42 projects/video links.rtf

@ -0,0 +1,25 @@
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\f0\fs24 \cf0 https://www.youtube.com/playlist?list=PLVQYiy6xNUxxhvwi0PGmXb5isUdVwmsg8\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxxhvwi0PGmXb5isUdVwmsg8\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxzusAgMiybYwkLvuMFbVat9\
\pard\pardeftab720\sl380\partightenfactor0
\cf0 https://www.youtube.com/playlist?list=PLVQYiy6xNUxwmUOmyYSaI6gD1UyfF9MSj\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxx8sKygTdqtOPytqN7sb0Vz\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxw_vu1L7tOoddOsHnZQwVf7\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxw6n6q_i8wek6U7t7CeAXhU\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxxMI_GiGGb2hxMcd3IwNYRy\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxzNYF00nlmx624twFlamqLt\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxxDlCkkCX262SI90TsllYUW\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxxZbeH9b0VC-nC6QsJRw5Ah\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxzlA5vk2B1xVjjGBJy7R4X4\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxyT9xyetVAA3jPMlIpYpl5S\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxzpalWNSNJc4wEDmfs2Mj5t\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxytsXWxZx6odBJMbRktIHTs\
https://www.youtube.com/playlist?list=PLVQYiy6xNUxz5wbzZn4tfUhF4djgzscB-\
}

BIN
c00/c00.pdf

Binary file not shown.

18
c00/ex00/ft_putchar.c

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/03 09:15:01 by tharre #+# #+# */
/* Updated: 2020/07/03 09:15:42 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}

25
c00/ex01/ft_print_alphabet.c

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/02 18:31:43 by tharre #+# #+# */
/* Updated: 2020/07/03 10:06:48 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
int i;
i = 97;
while (i <= 122)
{
write(1, &i, 1);
i++;
}
}

25
c00/ex02/ft_print_reverse_alphabet.c

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <masonbee@posteo.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/02 18:53:30 by tharre #+# #+# */
/* Updated: 2020/07/03 10:28:34 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_reverse_alphabet(void)
{
int i;
i = 122;
while (i >= 97)
{
write(1, &i, 1);
i--;
}
}

25
c00/ex03/ft_print_numbers.c

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/03 10:28:53 by tharre #+# #+# */
/* Updated: 2020/07/03 10:40:35 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
int i;
i = 48;
while (i <= 57)
{
write(1, &i, 1);
i++;
}
}

29
c00/ex04/ft_is_negative.c

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/03 10:40:55 by tharre #+# #+# */
/* Updated: 2020/07/03 11:19:44 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_is_negative(int n)
{
int o;
o = 78;
if (n < 0)
{
write(1, &o, 1);
}
else
{
o = 80;
write(1, &o, 1);
}
}

61
c00/ex05/ft_print_comb.c

@ -0,0 +1,61 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/03 11:23:31 by tharre #+# #+# */
/* Updated: 2020/07/05 14:08:37 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void print(char i, char b, char c)
{
char m;
char s;
m = 44;
s = 32;
ft_putchar(i);
ft_putchar(b);
ft_putchar(c);
if (!((i == '7') && (b == '8') && (c == '9')))
{
ft_putchar(m);
ft_putchar(s);
}
}
void ft_print_comb(void)
{
char b;
char c;
char i;
i = '0';
b = '1';
c = '2';
while (i <= '7')
{
b = i + 1;
while (b <= '8')
{
c = b + 1;
while (c <= '9')
{
print(i, b, c);
c++;
}
b++;
}
i++;
}
}

45
c00/ex06/ft_print_comb2.c

@ -0,0 +1,45 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/05 14:20:26 by tharre #+# #+# */
/* Updated: 2020/07/05 15:54:19 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_print_comb2(void)
{
int a;
int b;
a = 0;
while (a <= 98)
{
b = a + 1;
while (b <= 99)
{
ft_putchar('0' + (a / 10));
ft_putchar('0' + (a % 10));
ft_putchar(32);
ft_putchar('0' + (b / 10));
ft_putchar('0' + (b % 10));
if (a != 98)
{
ft_putchar(44);
ft_putchar(32);
}
b++;
}
a++;
}
}

55
c00/ex07/ft_putnbr.c

@ -0,0 +1,55 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/04 19:16:59 by tharre #+# #+# */
/* Updated: 2020/07/05 13:34:20 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void iterate_nbr(char c, long lnb, int e)
{
int i;
int f;
f = 0;
i = 9;
while (i >= 0)
{
c = 48 + lnb / e;
if (c != 48 || f == 1)
{
ft_putchar(c);
f = 1;
}
lnb = lnb % e;
e = e / 10;
i--;
}
}
void ft_putnbr(int nb)
{
char c;
int e;
long lnb;
lnb = nb;
e = 1000000000;
if (lnb < 0)
{
ft_putchar(45);
lnb = lnb * -1;
}
iterate_nbr(c, lnb, e);
}

37
c00/ex08/ft_print_combn.c

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_combn.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/05 16:06:54 by tharre #+# #+# */
/* Updated: 2020/07/05 16:25:54 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write( 1, &c, 1);
}
void ft_print_combo(int n)
{
int i;
i = 1;
while (i <= n)
{
ft_putchar(i + 48);
i++;
}
ft_putchar(44);
ft_putchar(32);
}
int main()
{
ft_print_combo(6);
}

BIN
c01/c01.pdf

Binary file not shown.

16
c01/ex00/ft_ft.c

@ -0,0 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/05 16:54:00 by tharre #+# #+# */
/* Updated: 2020/07/05 19:24:16 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ft(int *nbr)
{
*nbr = 42;
}

16
c01/ex01/ft_ultimate_ft.c

@ -0,0 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/05 19:23:26 by tharre #+# #+# */
/* Updated: 2020/07/05 19:27:45 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_ft(int *********nbr)
{
*********nbr = 42;
}

20
c01/ex02/ft_swap.c

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 08:50:59 by tharre #+# #+# */
/* Updated: 2020/07/06 09:44:14 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int s;
s = *a;
*a = *b;
*b = s;
}

17
c01/ex03/ft_div_mod.c

@ -0,0 +1,17 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 09:46:45 by tharre #+# #+# */
/* Updated: 2020/07/06 10:11:47 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_div_mod(int a, int b, int *div, int *mod)
{
*div = a / b;
*mod = a % b;
}

20
c01/ex04/ft_ultimate_div_mod.c

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 10:15:14 by tharre #+# #+# */
/* Updated: 2020/07/06 10:35:17 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_div_mod(int *a, int *b)
{
int temp;
temp = *a / *b;
*b = *a % *b;
*a = temp;
}

27
c01/ex05/ft_putstr.c

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 10:37:20 by tharre #+# #+# */
/* Updated: 2020/07/06 14:11:07 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_put_char(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
while (*str != '\0')
{
ft_put_char(*str);
str++;
}
}

24
c01/ex06/ft_strlen.c

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 14:20:29 by tharre #+# #+# */
/* Updated: 2020/07/06 14:34:49 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int len;
len = 0;
while (*str != '\0')
{
len++;
str++;
}
return (len);
}

30
c01/ex07/ft_rev_int_tab.c

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 14:36:57 by tharre #+# #+# */
/* Updated: 2020/07/06 15:57:22 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_rev_int_tab(int *tab, int size)
{
int t;
int i;
int u;
t = 0;
i = 0;
u = size - 1;
while (i < (size / 2))
{
t = *(tab + i);
*(tab + i) = *(tab + u);
*(tab + u) = t;
i++;
u--;
}
}

BIN
c01/ex08/.ft_sort_int_tab.c.swp

Binary file not shown.

37
c01/ex08/ft_sort_int_tab.c

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 15:59:35 by tharre #+# #+# */
/* Updated: 2020/07/06 17:48:20 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
void ft_sort_int_tab(int *tab, int size)
{
int i;
int j;
int s;
j = 0;
i = 0;
s = 0;
while (j < (size - 1))
{
while (i < (size - 1))
{
if (*(tab + i) > *(tab + i + 1))
{
s = *(tab + i);
*(tab + i) = *(tab + i + 1);
*(tab + i + 1) = s;
}
i++;
}
i = 0;
j++;
}
}

BIN
c02/c02.pdf

Binary file not shown.

25
c02/ex00/ft_strcpy.c

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 17:56:31 by tharre #+# #+# */
/* Updated: 2020/07/07 09:15:41 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}

29
c02/ex01/ft_strncpy.c

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 09:20:02 by tharre #+# #+# */
/* Updated: 2020/07/08 19:18:09 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (src[i] != '\0' && i < n)
{
dest[i] = src[i];
i++;
}
while (i < n)
{
dest[i] = '\0';
i++;
}
return (dest);
}

33
c02/ex02/ft_str_is_alpha.c

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 10:54:10 by tharre #+# #+# */
/* Updated: 2020/07/08 17:09:52 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
int i;
int r;
i = 0;
r = 1;
while (str[i])
{
if (str[i] <= 64 || str[i] >= 123)
{
r = 0;
}
else if (str[i] >= 91 && str[i] <= 96)
{
r = 0;
}
i++;
}
return (r);
}

33
c02/ex03/ft_str_is_numeric.c

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 11:48:32 by tharre #+# #+# */
/* Updated: 2020/07/07 12:53:36 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
int i;
int r;
i = 0;
r = 1;
while (str[i] != '\0')
{
if (str[i] < '0' || str[i] > '9')
{
r = 0;
}
i++;
}
if (i == 0)
{
r = 1;
}
return (r);
}

29
c02/ex04/ft_str_is_lowercase.c

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 12:55:26 by tharre #+# #+# */
/* Updated: 2020/07/07 13:10:20 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
int i;
int r;
i = 0;
r = 1;
while (str[i])
{
if (str[i] < 'a' || str[i] > 'z')
{
r = 0;
}
i++;
}
return (r);
}

29
c02/ex05/ft_str_is_uppercase.c

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 13:12:22 by tharre #+# #+# */
/* Updated: 2020/07/07 13:17:53 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
int i;
int r;
i = 0;
r = 1;
while (str[i])
{
if (str[i] < 'A' || str[i] > 'Z')
{
r = 0;
}
i++;
}
return (r);
}

29
c02/ex06/ft_str_is_printable.c

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 13:22:40 by tharre #+# #+# */
/* Updated: 2020/07/08 17:35:12 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
int i;
int r;
i = 0;
r = 1;
while (str[i])
{
if (str[i] < ' ' || str[i] > '~')
{
r = 0;
}
i++;
}
return (r);
}

27
c02/ex07/ft_strupcase.c

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* wft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 13:30:32 by tharre #+# #+# */
/* Updated: 2020/07/08 18:14:06 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 'a' && str[i] <= 'z')
{
str[i] = str[i] - 32;
}
i++;
}
return (str);
}

27
c02/ex08/ft_strlowcase.c

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 14:09:38 by tharre #+# #+# */
/* Updated: 2020/07/08 18:26:24 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 'A' && str[i] <= 'Z')
{
str[i] = str[i] + 32;
}
i++;
}
return (str);
}

55
c02/ex09/ft_strcapitalize.c

@ -0,0 +1,55 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 14:18:27 by tharre #+# #+# */
/* Updated: 2020/07/09 17:05:23 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i])
{
if (str[i] >= 'A' && str[i] <= 'Z')
{
str[i] = str[i] + 32;
}
i++;
}
return (str);
}
char *ft_strcapitalize(char *str)
{
int i;
int t;
int m;
i = 0;
t = 'a';
m = 0;
ft_strlowcase(str);
while (str[i])
{
if (i > 0)
t = str[i - 1];
if ((t >= '1' && t <= '9') || (t >= 'a' && t <= 'z'))
m++;
if (t >= 'A' && t <= 'Z')
m++;
if (m == 0 && (str[i] >= 'a' && str[i] <= 'z'))
str[i] = str[i] - 32;
m = 0;
i++;
}
if (str[0] >= 'a' && str[0] <= 'z')
str[0] = str[0] - 32;
return (str);
}

32
c02/ex10/ft_strlcpy.c

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 16:25:17 by tharre #+# #+# */
/* Updated: 2020/07/08 18:48:31 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i;
unsigned int l;
i = 0;
l = 0;
while (src[i] != '\0' && i < size - 1)
{
dest[i] = src[i];
i++;
l++;
}
while (i < size)
{
dest[i] = '\0';
i++;
}
return (l);
}

54
c02/ex11/ft_putstr_non_printable.c

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr_non_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/07 17:07:50 by tharre #+# #+# */
/* Updated: 2020/07/08 19:16:27 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void convert_dec_hex(int t)
{
int r;
char *hex;
hex = "0123456789abcdf";
r = 0;
ft_putchar(92);
r = t / 16;
ft_putchar(hex[r]);
r = t % 16;
ft_putchar(hex[r]);
}
void ft_putstr_non_printable(char *str)
{
int i;
int t;
i = 0;
t = 0;
while (str[i] != '\0')
{
if (str[i] < ' ')
{
t = str[i];
convert_dec_hex(t);
}
else
{
ft_putchar(str[i]);
}
i++;
}
}

BIN
c03/c03.pdf

Binary file not shown.

21
c03/ex00/ft_strcmp.c

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 10:28:39 by tharre #+# #+# */
/* Updated: 2020/07/11 17:26:49 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while ((s1[i] || s2[i]) && s1[i] == s2[i])
i++;
return (s1[i] - s2[i]);
}

23
c03/ex01/ft_strncmp.c

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 11:59:57 by tharre #+# #+# */
/* Updated: 2020/07/12 09:12:11 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
unsigned int i;
i = 0;
if (n == 0)
return (0);
while ((s1[i] || s2[i]) && s1[i] == s2[i] && i < n - 1)
i++;
return (s1[i] - s2[i]);
}

32
c03/ex02/ft_strcat.c

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 12:28:43 by tharre #+# #+# */
/* Updated: 2020/07/10 15:00:45 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcat(char *dest, char *src)
{
int i;
int d;
i = 0;
d = 0;
while (dest[d] != '\0')
{
d++;
}
while (src[i] != '\0')
{
dest[d] = src[i];
i++;
d++;
}
dest[d] = '\0';
return (dest);
}

32
c03/ex03/ft_strncat.c

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 14:08:33 by tharre #+# #+# */
/* Updated: 2020/07/10 15:08:59 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
unsigned int i;
int d;
i = 0;
d = 0;
while (dest[d] != '\0')
{
d++;
}
while (src[i] != '\0' && i < nb)
{
dest[d] = src[i];
i++;
d++;
}
dest[d] = '\0';
return (dest);
}

42
c03/ex04/ft_strstr.c

@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/08 14:31:12 by tharre #+# #+# */
/* Updated: 2020/07/09 19:20:31 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
char *ft_strstr(char *str, char *to_find)
{
int i;
int t;
int o;
i = 0;
t = 0;
o = 0;
while (to_find[t])
t++;
if (t == 0)
return (str);
while (str[i])
{
if (str[i] == to_find[0])
{
while (str[i + o] == to_find[o])
{
o++;
if (o == t)
return (&str[i]);
}
}
i++;
}
return (NULL);
}

31
c03/ex05/ft_strlcat.c

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/10 08:41:17 by tharre #+# #+# */
/* Updated: 2020/07/12 09:26:14 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcat(char *dest, char *src, unsigned int size)
{
unsigned int i;
unsigned int d;
i = 0;
d = 0;
while (dest[d] != '\0')
d++;
while ((src[i] || dest[d]) && i < size - 1)
{
dest[d] = src[i];
i++;
d++;
}
if (size >= 0 && d <= size)
dest[d] = '\0';
return (d);
}

BIN
c04/c04.pdf

Binary file not shown.

21
c04/ex00/ft_strlen.c

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/11 09:10:00 by tharre #+# #+# */
/* Updated: 2020/07/11 09:22:21 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
i++;
return (i);
}

30
c04/ex01/ft_putstr.c

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/11 09:22:52 by tharre #+# #+# */
/* Updated: 2020/07/11 09:29:00 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
ft_putchar(str[i]);
i++;
}
}

BIN
c04/ex02/.DS_Store vendored

Binary file not shown.

56
c04/ex02/ft_putnbr.c

@ -0,0 +1,56 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/11 09:31:08 by tharre #+# #+# */
/* Updated: 2020/07/21 17:30:43 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
long ft_check_input(long nbl)
{
if (nbl == 0)
{
ft_putchar('0');
}
else if (nbl < 0)
{
ft_putchar('-');
nbl = nbl * -1;
}
return (nbl);
}
void ft_putnbr(int nb)
{
long f;
long t;
long nbl;
f = 1;
nbl = nb;
nbl = ft_check_input(nbl);
t = nbl;
while (t)
{
t = t / 10;
f = f * 10;
}
while (f > 1)
{
f = f / 10;
t = (nbl / f) + 48;
ft_putchar(t);
nbl = nbl % f;
}
}

37
c04/ex03/ft_atoi.c

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tharre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/12 11:18:42 by tharre #+# #+# */
/* Updated: 2020/07/21 12:28:10 by tharre ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int i;
int p;
long n;
i = 0;
p = 1;
n = 0;
while ((str[i] >= 9 && str[i] <= 13) || str[i] == ' ')
i++;
while (str[i] == '-' || str[i] == '+')
{
if (str[i] == '-')
p *= -1;
i++;
}
while (str[i] >= '0' && str[i] <= '9')
{