diff --git a/C_Piscine_C_00/git/.gitignore b/C_Piscine_C_00/git/.gitignore deleted file mode 100644 index 872b9a9..0000000 --- a/C_Piscine_C_00/git/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -**/main.c -**/main.sh diff --git a/C_Piscine_C_00/git/ex00/main.c b/C_Piscine_C_00/git/ex00/main.c new file mode 100644 index 0000000..87c23ab --- /dev/null +++ b/C_Piscine_C_00/git/ex00/main.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:12:43 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 13:17:47 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int main(void) +{ + void ft_putchar(char c); + + ft_putchar('Z'); + return (0); +} diff --git a/C_Piscine_C_00/git/ex00/main.sh b/C_Piscine_C_00/git/ex00/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex00/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex01/main.c b/C_Piscine_C_00/git/ex01/main.c new file mode 100644 index 0000000..87ce6aa --- /dev/null +++ b/C_Piscine_C_00/git/ex01/main.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:12:05 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 13:17:31 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int main(void) +{ + void ft_print_alphabet(void); + + ft_print_alphabet(); + return (0); +} diff --git a/C_Piscine_C_00/git/ex01/main.sh b/C_Piscine_C_00/git/ex01/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex01/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex02/main.c b/C_Piscine_C_00/git/ex02/main.c new file mode 100644 index 0000000..25da75b --- /dev/null +++ b/C_Piscine_C_00/git/ex02/main.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:14:21 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 13:17:07 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int main(void) +{ + void ft_print_reverse_alphabet(void); + + ft_print_reverse_alphabet(); + return (0); +} diff --git a/C_Piscine_C_00/git/ex02/main.sh b/C_Piscine_C_00/git/ex02/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex02/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex03/main.c b/C_Piscine_C_00/git/ex03/main.c new file mode 100644 index 0000000..7e8010c --- /dev/null +++ b/C_Piscine_C_00/git/ex03/main.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:15:56 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 13:16:46 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int main(void) +{ + void ft_print_numbers(void); + + ft_print_numbers(); + return (0); +} diff --git a/C_Piscine_C_00/git/ex03/main.sh b/C_Piscine_C_00/git/ex03/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex03/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex04/main.c b/C_Piscine_C_00/git/ex04/main.c new file mode 100644 index 0000000..d8d6f1b --- /dev/null +++ b/C_Piscine_C_00/git/ex04/main.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:18:40 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 13:48:41 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +int main(void) +{ + void ft_is_negative(int n); + + ft_is_negative(-42); + ft_is_negative(42); + ft_is_negative(0); + return (0); +} diff --git a/C_Piscine_C_00/git/ex04/main.sh b/C_Piscine_C_00/git/ex04/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex04/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex05/main.c b/C_Piscine_C_00/git/ex05/main.c new file mode 100644 index 0000000..3dab0fe --- /dev/null +++ b/C_Piscine_C_00/git/ex05/main.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 13:50:48 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 14:55:52 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +int main(void) +{ + void ft_print_comb(void); + + ft_print_comb(); + return (0); +} diff --git a/C_Piscine_C_00/git/ex05/main.sh b/C_Piscine_C_00/git/ex05/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex05/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex06/main.c b/C_Piscine_C_00/git/ex06/main.c new file mode 100644 index 0000000..1b8c785 --- /dev/null +++ b/C_Piscine_C_00/git/ex06/main.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 17:38:55 by gbaconni #+# #+# */ +/* Updated: 2021/08/05 17:39:00 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +int main(void) +{ + void ft_print_comb2(void); + + ft_print_comb2(); + return (0); +} diff --git a/C_Piscine_C_00/git/ex06/main.sh b/C_Piscine_C_00/git/ex06/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex06/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex07/main.c b/C_Piscine_C_00/git/ex07/main.c new file mode 100644 index 0000000..c183556 --- /dev/null +++ b/C_Piscine_C_00/git/ex07/main.c @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/05 18:07:44 by gbaconni #+# #+# */ +/* Updated: 2021/08/06 11:48:27 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int main(void) +{ + void ft_putnbr(int nb); + + ft_putnbr(-1); + write(1, "\n", 1); + ft_putnbr(0); + write(1, "\n", 1); + ft_putnbr(42); + write(1, "\n", 1); + ft_putnbr(2147483647); + return (0); +} diff --git a/C_Piscine_C_00/git/ex07/main.sh b/C_Piscine_C_00/git/ex07/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex07/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_00/git/ex08/main.c b/C_Piscine_C_00/git/ex08/main.c new file mode 100644 index 0000000..028ff4d --- /dev/null +++ b/C_Piscine_C_00/git/ex08/main.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/06 09:41:51 by gbaconni #+# #+# */ +/* Updated: 2021/08/06 11:32:04 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int main(void) +{ + void ft_print_combn(int n); + + ft_print_combn(1); + write(1, "\n", 1); + ft_print_combn(2); + write(1, "\n", 1); + ft_print_combn(3); + write(1, "\n", 1); + ft_print_combn(4); + write(1, "\n", 1); + return (0); +} diff --git a/C_Piscine_C_00/git/ex08/main.sh b/C_Piscine_C_00/git/ex08/main.sh new file mode 100755 index 0000000..0b59d38 --- /dev/null +++ b/C_Piscine_C_00/git/ex08/main.sh @@ -0,0 +1,6 @@ +#!/bin/sh +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/.gitignore b/C_Piscine_C_01/git/.gitignore deleted file mode 100644 index 2c8cfde..0000000 --- a/C_Piscine_C_01/git/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -**/main.c -**/main.sh -**/a.out -**/a.sh -**/Makefile diff --git a/C_Piscine_C_01/git/ex00/main.c b/C_Piscine_C_01/git/ex00/main.c new file mode 100644 index 0000000..65ccc26 --- /dev/null +++ b/C_Piscine_C_01/git/ex00/main.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 09:26:01 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 09:26:03 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_ft(int *nbr); + +int main(void) +{ + int n; + + n = 0; + ft_ft(&n); + printf("%d\n", n); + return (0); +} diff --git a/C_Piscine_C_01/git/ex00/main.sh b/C_Piscine_C_01/git/ex00/main.sh new file mode 100755 index 0000000..a816fcd --- /dev/null +++ b/C_Piscine_C_01/git/ex00/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex01/main.c b/C_Piscine_C_01/git/ex01/main.c new file mode 100644 index 0000000..790318c --- /dev/null +++ b/C_Piscine_C_01/git/ex01/main.c @@ -0,0 +1,44 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 10:33:35 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 10:33:36 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_ultimate_ft(int *********nbr); + +int main(void) +{ + int n; + int *ptr1; + int **ptr2; + int ***ptr3; + int ****ptr4; + int *****ptr5; + int ******ptr6; + int *******ptr7; + int ********ptr8; + int *********ptr9; + + n = 0; + ptr1 = &n; + ptr2 = &ptr1; + ptr3 = &ptr2; + ptr4 = &ptr3; + ptr5 = &ptr4; + ptr6 = &ptr5; + ptr7 = &ptr6; + ptr8 = &ptr7; + ptr9 = &ptr8; + ft_ultimate_ft(ptr9); + printf("%d\n", n); + return (0); +} diff --git a/C_Piscine_C_01/git/ex01/main.sh b/C_Piscine_C_01/git/ex01/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex01/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex02/main.c b/C_Piscine_C_01/git/ex02/main.c new file mode 100644 index 0000000..9ae499f --- /dev/null +++ b/C_Piscine_C_01/git/ex02/main.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 10:45:18 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 10:49:16 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_swap(int *a, int *b); + +int main(void) +{ + int a; + int b; + + a = 21; + b = 42; + printf("BEFORE: a=%d b=%d\n", a, b); + ft_swap(&a, &b); + printf("AFTER: a=%d b=%d\n", a, b); + return (0); +} diff --git a/C_Piscine_C_01/git/ex02/main.sh b/C_Piscine_C_01/git/ex02/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex02/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex03/main.c b/C_Piscine_C_01/git/ex03/main.c new file mode 100644 index 0000000..b4c4030 --- /dev/null +++ b/C_Piscine_C_01/git/ex03/main.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 10:51:11 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 10:56:46 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_div_mod(int a, int b, int *div, int *mod); + +int main(void) +{ + int a; + int b; + int div; + int mod; + + a = 43; + b = 21; + div = 0; + mod = 0; + printf("BEFORE: a=%d b=%d div=%d mod=%d\n", a, b, div, mod); + ft_div_mod(a, b, &div, &mod); + printf("AFTER: a=%d b=%d div=%d mod=%d\n", a, b, div, mod); + return (0); +} diff --git a/C_Piscine_C_01/git/ex03/main.sh b/C_Piscine_C_01/git/ex03/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex03/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex04/main.c b/C_Piscine_C_01/git/ex04/main.c new file mode 100644 index 0000000..a76a609 --- /dev/null +++ b/C_Piscine_C_01/git/ex04/main.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 11:08:45 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 11:08:47 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_ultimate_div_mod(int *a, int *b); + +int main(void) +{ + int a; + int b; + + a = 43; + b = 21; + printf("BEFORE: a=%d b=%d\n", a, b); + ft_ultimate_div_mod(&a, &b); + printf("AFTER: a=%d b=%d\n", a, b); + return (0); +} diff --git a/C_Piscine_C_01/git/ex04/main.sh b/C_Piscine_C_01/git/ex04/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex04/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex05/main.c b/C_Piscine_C_01/git/ex05/main.c new file mode 100644 index 0000000..f465fdc --- /dev/null +++ b/C_Piscine_C_01/git/ex05/main.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 11:12:49 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 11:19:05 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_putstr(char *str); + +int main(void) +{ + ft_putstr("42"); + write(1, "\n", 1); + ft_putstr("Hello"); + write(1, "\n", 1); + ft_putstr("World"); + write(1, "\n", 1); + return (0); +} diff --git a/C_Piscine_C_01/git/ex05/main.sh b/C_Piscine_C_01/git/ex05/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex05/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex06/main.c b/C_Piscine_C_01/git/ex06/main.c new file mode 100644 index 0000000..e4d4841 --- /dev/null +++ b/C_Piscine_C_01/git/ex06/main.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 11:21:01 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 11:25:11 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int ft_strlen(char *str); + +int main(void) +{ + int size; + + size = ft_strlen("42"); + printf("size=%d (42)\n", size); + size = ft_strlen("Hello"); + printf("size=%d (Hello)\n", size); + size = ft_strlen("World"); + printf("size=%d (World)\n", size); + return (0); +} diff --git a/C_Piscine_C_01/git/ex06/main.sh b/C_Piscine_C_01/git/ex06/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex06/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex07/main.c b/C_Piscine_C_01/git/ex07/main.c new file mode 100644 index 0000000..6e98ad6 --- /dev/null +++ b/C_Piscine_C_01/git/ex07/main.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 13:38:52 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 17:02:02 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_rev_int_tab(int *tab, int size); + +int main(void) +{ + int tab5[5]; + int tab2[2]; + + tab5[0] = 1; + tab5[1] = 2; + tab5[2] = 3; + tab5[3] = 4; + tab5[4] = 5; + tab2[0] = 1; + tab2[1] = 2; + printf("%d,%d,%d,%d,%d\n", tab5[0], tab5[1], tab5[2], tab5[3], tab5[4]); + ft_rev_int_tab(tab5, 5); + printf("%d,%d,%d,%d,%d\n", tab5[0], tab5[1], tab5[2], tab5[3], tab5[4]); + printf("%d,%d\n", tab2[0], tab2[1]); + ft_rev_int_tab(tab2, 2); + printf("%d,%d\n", tab2[0], tab2[1]); + ft_rev_int_tab(tab2, 2); + return (0); +} diff --git a/C_Piscine_C_01/git/ex07/main.sh b/C_Piscine_C_01/git/ex07/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex07/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_01/git/ex08/main.c b/C_Piscine_C_01/git/ex08/main.c new file mode 100644 index 0000000..bb1f4ed --- /dev/null +++ b/C_Piscine_C_01/git/ex08/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 14:22:56 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 14:42:03 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +void ft_sort_int_tab(int *tab, int size); + +int main(void) +{ + int tab[4]; + + tab[0] = 31; + tab[1] = 21; + tab[2] = 7; + tab[3] = 12; + printf("%d,%d,%d,%d\n", tab[0], tab[1], tab[2], tab[3]); + ft_sort_int_tab(tab, 4); + printf("%d,%d,%d,%d\n", tab[0], tab[1], tab[2], tab[3]); + return (0); +} diff --git a/C_Piscine_C_01/git/ex08/main.sh b/C_Piscine_C_01/git/ex08/main.sh new file mode 100755 index 0000000..9078e13 --- /dev/null +++ b/C_Piscine_C_01/git/ex08/main.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +norminette -R CheckForbiddenSourceHeader ft_*.c +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/.gitignore b/C_Piscine_C_02/git/.gitignore deleted file mode 100644 index d6d3690..0000000 --- a/C_Piscine_C_02/git/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -**/main.c -**/main.sh -**/a.out -**/a.sh -**/Makefile -**/*.swp -**/*~ diff --git a/C_Piscine_C_02/git/ex00/main.c b/C_Piscine_C_02/git/ex00/main.c new file mode 100644 index 0000000..a063b9f --- /dev/null +++ b/C_Piscine_C_02/git/ex00/main.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 13:15:38 by gbaconni #+# #+# */ +/* Updated: 2021/08/11 14:30:26 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strcpy(char *dest, char *src); + +int main(void) +{ + char src[32]; + char dest[32]; + char *result; + + printf("Input [max 31]: "); + scanf("%s", src); + result = ft_strcpy(dest, src); + printf("src=%s dest=%s result=%s (ft_strcpy)\n", src, dest, result); + result = strcpy(dest, src); + printf("src=%s dest=%s result=%s (strcpy)\n", src, dest, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex00/main.sh b/C_Piscine_C_02/git/ex00/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex00/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex01/main.c b/C_Piscine_C_02/git/ex01/main.c new file mode 100644 index 0000000..e902b72 --- /dev/null +++ b/C_Piscine_C_02/git/ex01/main.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 18:18:58 by gbaconni #+# #+# */ +/* Updated: 2021/08/11 18:07:07 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strncpy(char *dest, char *src, unsigned int n); + +int main(void) +{ + char src[32]; + char dest[64]; + unsigned int n; + char *result; + + n = 0; + printf("Input String [max 31]: "); + scanf("%s", src); + printf("Input Size: "); + scanf("%d", &n); + result = ft_strncpy(dest, src, n); + printf("src=%s dest=%s n=%d result=%s (ft_strncpy)\n", src, dest, n, result); + result = strncpy(dest, src, n); + printf("src=%s dest=%s n=%d result=%s (strncpy)\n", src, dest, n, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex01/main.sh b/C_Piscine_C_02/git/ex01/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex01/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex02/._main.c b/C_Piscine_C_02/git/ex02/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex02/._main.c differ diff --git a/C_Piscine_C_02/git/ex02/main.c b/C_Piscine_C_02/git/ex02/main.c new file mode 100644 index 0000000..b629558 --- /dev/null +++ b/C_Piscine_C_02/git/ex02/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/09 17:44:56 by gbaconni #+# #+# */ +/* Updated: 2021/08/09 17:48:47 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_str_is_alpha(char *str); + +int main(void) +{ + char str[32]; + int result; + + printf("Input [max 31]: "); + scanf("%s", str); + result = ft_str_is_alpha(str); + printf("str=%s result=%d\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex02/main.sh b/C_Piscine_C_02/git/ex02/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex02/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex03/._main.c b/C_Piscine_C_02/git/ex03/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex03/._main.c differ diff --git a/C_Piscine_C_02/git/ex03/main.c b/C_Piscine_C_02/git/ex03/main.c new file mode 100644 index 0000000..64ded34 --- /dev/null +++ b/C_Piscine_C_02/git/ex03/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 10:13:03 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 10:15:13 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_str_is_numeric(char *str); + +int main(void) +{ + char str[32]; + int result; + + printf("Input [max 31]: "); + scanf("%s", str); + result = ft_str_is_numeric(str); + printf("str=%s result=%d\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex03/main.sh b/C_Piscine_C_02/git/ex03/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex03/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex04/._main.c b/C_Piscine_C_02/git/ex04/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex04/._main.c differ diff --git a/C_Piscine_C_02/git/ex04/main.c b/C_Piscine_C_02/git/ex04/main.c new file mode 100644 index 0000000..07725e4 --- /dev/null +++ b/C_Piscine_C_02/git/ex04/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 10:44:33 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 10:44:58 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_str_is_lowercase(char *str); + +int main(void) +{ + char str[32]; + int result; + + printf("Input [max 31]: "); + scanf("%s", str); + result = ft_str_is_lowercase(str); + printf("str=%s result=%d\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex04/main.sh b/C_Piscine_C_02/git/ex04/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex04/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex05/._main.c b/C_Piscine_C_02/git/ex05/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex05/._main.c differ diff --git a/C_Piscine_C_02/git/ex05/main.c b/C_Piscine_C_02/git/ex05/main.c new file mode 100644 index 0000000..ca1f74e --- /dev/null +++ b/C_Piscine_C_02/git/ex05/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 10:48:33 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 10:48:53 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_str_is_uppercase(char *str); + +int main(void) +{ + char str[32]; + int result; + + printf("Input [max 31]: "); + scanf("%s", str); + result = ft_str_is_uppercase(str); + printf("str=%s result=%d\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex05/main.sh b/C_Piscine_C_02/git/ex05/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex05/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex06/._main.c b/C_Piscine_C_02/git/ex06/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex06/._main.c differ diff --git a/C_Piscine_C_02/git/ex06/main.c b/C_Piscine_C_02/git/ex06/main.c new file mode 100644 index 0000000..f213dfc --- /dev/null +++ b/C_Piscine_C_02/git/ex06/main.c @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 11:05:36 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 11:05:59 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_str_is_printable(char *str); + +int main(void) +{ + char str[32]; + int result; + + printf("Input [max 31]: "); + scanf("%s", str); + result = ft_str_is_printable(str); + printf("str=%s result=%d\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex06/main.sh b/C_Piscine_C_02/git/ex06/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex06/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex07/main.c b/C_Piscine_C_02/git/ex07/main.c new file mode 100644 index 0000000..f44c22f --- /dev/null +++ b/C_Piscine_C_02/git/ex07/main.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 11:12:33 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 11:25:31 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strupcase(char *str); + +int main(void) +{ + char str[32]; + char *result; + + printf("Input [max 31]: "); + scanf("%s", str); + printf("str=%s\n", str); + result = ft_strupcase(str); + printf("str=%s result=%s\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex07/main.sh b/C_Piscine_C_02/git/ex07/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex07/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex08/main.c b/C_Piscine_C_02/git/ex08/main.c new file mode 100644 index 0000000..0a02c72 --- /dev/null +++ b/C_Piscine_C_02/git/ex08/main.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 11:40:15 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 11:40:52 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strlowcase(char *str); + +int main(void) +{ + char str[32]; + char *result; + + printf("Input [max 31]: "); + scanf("%s", str); + printf("str=%s\n", str); + result = ft_strlowcase(str); + printf("str=%s result=%s\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex08/main.sh b/C_Piscine_C_02/git/ex08/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex08/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex09/main.c b/C_Piscine_C_02/git/ex09/main.c new file mode 100644 index 0000000..4baa6c2 --- /dev/null +++ b/C_Piscine_C_02/git/ex09/main.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/10 11:43:49 by gbaconni #+# #+# */ +/* Updated: 2021/08/10 11:55:53 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strcapitalize(char *str); + +int main(void) +{ + char str[256]; + char *result; + + printf("Input [max 255]: "); + scanf("%255[^\n]", str); + printf("str=%s\n", str); + result = ft_strcapitalize(str); + printf("str=%s result=%s\n", str, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex09/main.sh b/C_Piscine_C_02/git/ex09/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex09/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex10/._main.c b/C_Piscine_C_02/git/ex10/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex10/._main.c differ diff --git a/C_Piscine_C_02/git/ex10/main.c b/C_Piscine_C_02/git/ex10/main.c new file mode 100644 index 0000000..a8aa32a --- /dev/null +++ b/C_Piscine_C_02/git/ex10/main.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/11 09:43:24 by gbaconni #+# #+# */ +/* Updated: 2021/08/11 10:43:00 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +unsigned int ft_strlcpy(char *dest, char *src, unsigned int size); + +int main(void) +{ + unsigned int size; + unsigned int result; + char src[16]; + char dest[16]; + + printf("Input Text [max 15]: "); + scanf("%15[^\n]", src); + printf("Input Size: "); + scanf("%u", &size); + result = ft_strlcpy(dest, src, size); + printf("src=%s dest=%s result=%d (ft_strlcpy)\n", src, dest, result); + result = strlcpy(dest, src, size); + printf("src=%s dest=%s result=%d (strlcpy)\n", src, dest, result); + return (0); +} diff --git a/C_Piscine_C_02/git/ex10/main.sh b/C_Piscine_C_02/git/ex10/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex10/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_02/git/ex11/._main.c b/C_Piscine_C_02/git/ex11/._main.c new file mode 100644 index 0000000..1e0761c Binary files /dev/null and b/C_Piscine_C_02/git/ex11/._main.c differ diff --git a/C_Piscine_C_02/git/ex11/main.c b/C_Piscine_C_02/git/ex11/main.c new file mode 100644 index 0000000..47c281e --- /dev/null +++ b/C_Piscine_C_02/git/ex11/main.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/11 11:24:31 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 11:44:53 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +void ft_putstr_non_printable(char *str); + +int main(void) +{ + const char *test = "Coucou\ntu vas bien ?"; + char str[256]; + + printf("Input [max 255]: "); + scanf("%255[^\n]", str); + printf("str=%s\n", str); + ft_putstr_non_printable(str); + printf("test=%s\n", test); + ft_putstr_non_printable((char *)test); + return (0); +} diff --git a/C_Piscine_C_02/git/ex11/main.sh b/C_Piscine_C_02/git/ex11/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_02/git/ex11/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/.gitignore b/C_Piscine_C_03/git/.gitignore deleted file mode 100644 index d6d3690..0000000 --- a/C_Piscine_C_03/git/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -**/main.c -**/main.sh -**/a.out -**/a.sh -**/Makefile -**/*.swp -**/*~ diff --git a/C_Piscine_C_03/git/ex00/main.c b/C_Piscine_C_03/git/ex00/main.c new file mode 100644 index 0000000..75f3845 --- /dev/null +++ b/C_Piscine_C_03/git/ex00/main.c @@ -0,0 +1,35 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 12:15:09 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 12:28:31 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_strcmp(char *s1, char *s2); + +int main(void) +{ + char s1[32]; + char s2[32]; + int result; + + printf("Input String #1 [max 31]: "); + scanf("%s", s1); + printf("Input String #2 [max 31]: "); + scanf("%s", s2); + result = ft_strcmp(s1, s2); + printf("s1=%s s2=%s result=%d (ft_strcmp)\n", s1, s2, result); + result = strcmp(s1, s2); + printf("s1=%s s2=%s result=%d (strcmp)\n", s1, s2, result); + return (0); +} diff --git a/C_Piscine_C_03/git/ex00/main.sh b/C_Piscine_C_03/git/ex00/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex00/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/ex01/main.c b/C_Piscine_C_03/git/ex01/main.c new file mode 100644 index 0000000..5598c11 --- /dev/null +++ b/C_Piscine_C_03/git/ex01/main.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 15:16:20 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 15:16:21 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +int ft_strncmp(char *s1, char *s2, unsigned int n); + +int main(void) +{ + char s1[32]; + char s2[32]; + unsigned int n; + int result; + + n = 0; + printf("Input String #1 [max 31]: "); + scanf("%s", s1); + printf("Input String #2 [max 31]: "); + scanf("%s", s2); + printf("Input Number: "); + scanf("%u", &n); + result = ft_strncmp(s1, s2, n); + printf("s1=%s s2=%s n=%d result=%d (ft_strncmp)\n", s1, s2, n, result); + result = strncmp(s1, s2, n); + printf("s1=%s s2=%s n=%d result=%d (strncmp)\n", s1, s2, n, result); + return (0); +} diff --git a/C_Piscine_C_03/git/ex01/main.sh b/C_Piscine_C_03/git/ex01/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex01/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/ex02/main.c b/C_Piscine_C_03/git/ex02/main.c new file mode 100644 index 0000000..77bcf09 --- /dev/null +++ b/C_Piscine_C_03/git/ex02/main.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 15:28:30 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 15:49:44 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strcat(char *dest, char *src); + +int main(void) +{ + char src[32]; + char dest[32]; + char dest2[32]; + char *result; + + printf("Input String #1 [max 31]: "); + scanf("%s", src); + printf("Input String #2 [max 31]: "); + scanf("%s", dest); + strcpy(dest2, dest); + result = ft_strcat(dest, src); + printf("src=%s dest=%s result=%s (ft_strcat)\n", src, dest, result); + result = strcat(dest2, src); + printf("src=%s dest=%s result=%s (strcat)\n", src, dest2, result); + return (0); +} diff --git a/C_Piscine_C_03/git/ex02/main.sh b/C_Piscine_C_03/git/ex02/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex02/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/ex03/main.c b/C_Piscine_C_03/git/ex03/main.c new file mode 100644 index 0000000..495d81b --- /dev/null +++ b/C_Piscine_C_03/git/ex03/main.c @@ -0,0 +1,41 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 16:21:11 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 16:44:38 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strncat(char *dest, char *src, unsigned int nb); + +int main(void) +{ + char src[32]; + char dest[32]; + char dest2[32]; + unsigned int nb; + char *r; + + nb = 0; + printf("Input String #1 [max 31]: "); + scanf("%s", src); + printf("Input String #2 [max 31]: "); + scanf("%s", dest); + printf("Input Number: "); + scanf("%u", &nb); + strcpy(dest2, dest); + r = ft_strncat(dest, src, nb); + printf("src=%s dest=%s nb=%d result=%s (ft_strncat)\n", src, dest, nb, r); + r = strncat(dest2, src, nb); + printf("src=%s dest=%s nb=%d result=%s (strncat)\n", src, dest2, nb, r); + return (0); +} diff --git a/C_Piscine_C_03/git/ex03/main.sh b/C_Piscine_C_03/git/ex03/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex03/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/ex04/main.c b/C_Piscine_C_03/git/ex04/main.c new file mode 100644 index 0000000..14d2a87 --- /dev/null +++ b/C_Piscine_C_03/git/ex04/main.c @@ -0,0 +1,35 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 16:49:41 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 17:07:20 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +char *ft_strstr(char *str, char *to_find); + +int main(void) +{ + char str[32]; + char to_find[32]; + char *r; + + printf("Input String #1 [max 31]: "); + scanf("%s", str); + printf("Input String #2 [max 31]: "); + scanf("%s", to_find); + r = ft_strstr(str, to_find); + printf("str=%s to_find=%s result=%s (ft_strstr)\n", str, to_find, r); + r = strstr(str, to_find); + printf("str=%s to_find=%s result=%s (strstr)\n", str, to_find, r); + return (0); +} diff --git a/C_Piscine_C_03/git/ex04/main.sh b/C_Piscine_C_03/git/ex04/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex04/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_03/git/ex05/main.c b/C_Piscine_C_03/git/ex05/main.c new file mode 100644 index 0000000..05992f1 --- /dev/null +++ b/C_Piscine_C_03/git/ex05/main.c @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gbaconni +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/08/12 15:28:30 by gbaconni #+# #+# */ +/* Updated: 2021/08/12 17:22:10 by gbaconni ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include + +unsigned int ft_strlcat(char *dest, char *src, unsigned int size); + +int main(void) +{ + char src[32]; + char dest[32]; + unsigned int size; + unsigned int r; + + size = 0; + r = 0; + printf("Input String #1 [max 31]: "); + scanf("%s", src); + printf("Input String #2 [max 31]: "); + scanf("%s", dest); + printf("Input Number: "); + scanf("%u", &size); + r = ft_strlcat(dest, src, size); + printf("src=%s dest=%s size=%d r=%d (ft_strlcat)\n", src, dest, size, r); + r = strlcat(dest, src, size); + printf("src=%s dest=%s size=%d r=%d (strlcat)\n", src, dest, size, r); + return (0); +} diff --git a/C_Piscine_C_03/git/ex05/main.sh b/C_Piscine_C_03/git/ex05/main.sh new file mode 100755 index 0000000..292faee --- /dev/null +++ b/C_Piscine_C_03/git/ex05/main.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +#norminette -R CheckForbiddenSourceHeader ft_*.c +norminette -R CheckForbiddenSourceHeader +gcc -Wall -Wextra -Werror -o a.out *.c +echo $(basename $PWD): +./a.out +rm -f a.out diff --git a/C_Piscine_C_04/git/.gitignore b/C_Piscine_C_04/git/.gitignore deleted file mode 100644 index d6d3690..0000000 --- a/C_Piscine_C_04/git/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -**/main.c -**/main.sh -**/a.out -**/a.sh -**/Makefile -**/*.swp -**/*~ diff --git a/C_Piscine_Shell_00/git/.gitignore b/C_Piscine_Shell_00/git/.gitignore deleted file mode 100644 index c3d48d4..0000000 --- a/C_Piscine_Shell_00/git/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -mywork.c~