├── source
├── j00
│ ├── ex02
│ │ ├── test3
│ │ ├── test4
│ │ ├── test5
│ │ ├── test6
│ │ ├── test1
│ │ └── exo2.tar
│ └── ex09
│ │ ├── a
│ │ ├── b
│ │ └── sw.diff
├── j01
│ └── ex05
│ │ └── "\?$*’KwaMe’*$?\"
├── j02
│ ├── prog
│ ├── ft_print_alphabet.c
│ ├── ex04
│ │ └── ft_print_comb.c
│ └── prog.c
├── j03
│ ├── prog
│ ├── test
│ ├── test2
│ ├── ex00
│ │ ├── prog
│ │ ├── ft_ft.c
│ │ └── prog.c
│ ├── ex01
│ │ ├── prog
│ │ ├── ft_ultimate_ft.c
│ │ └── prog.c
│ ├── ex02
│ │ ├── prog
│ │ ├── ft_div_mod.c
│ │ └── prog.c
│ ├── ex04
│ │ ├── prog
│ │ ├── ft_putstr.c
│ │ └── prog.c
│ ├── ex05
│ │ ├── prog
│ │ ├── ft_strlen.c
│ │ └── prog.c
│ ├── ex06
│ │ ├── prog
│ │ ├── ft_swap.c
│ │ └── prog.c
│ ├── ex07
│ │ ├── prog
│ │ ├── ft_strrev.c
│ │ └── prog.c
│ ├── ex08
│ │ ├── prog
│ │ ├── main.c
│ │ └── ft_atoi.c
│ ├── ex07-2
│ │ ├── prog
│ │ ├── .ft_strrev.c.swo
│ │ ├── ft_strrev.c
│ │ └── prog.c
│ ├── ft_ft.c
│ ├── ft_ultimate_ft.c
│ ├── ft_div_mod.c
│ ├── ex03
│ │ ├── ft_ultimate_div_mod.c
│ │ └── prog_ft_ultimate_div.c
│ ├── ft_ultimate_div_mod.c
│ ├── prog.c
│ ├── prog_ft_ultimate_div.c
│ └── test2.c
├── j06
│ ├── ex00-source
│ │ ├── libft_creator.sh
│ │ ├── ft_putnbr.c
│ │ ├── ft_putchar.c
│ │ ├── ft_swap.c
│ │ ├── ft_strlen.c
│ │ ├── ft_putstr.c
│ │ └── ft_strcmp.c
│ ├── ex00
│ │ ├── prog
│ │ └── main.c
│ ├── main.c
│ ├── ex01
│ │ └── ft_print_program_name.c
│ ├── ex02
│ │ └── ft_print_params.c
│ ├── ex03
│ │ └── ft_rev_params.c
│ └── ex04
│ │ └── ft_sort_params.c
├── j04
│ ├── ex00
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── main.c
│ │ └── ft_iterative_factorial.c
│ ├── ex01
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── main.c
│ │ └── ft_recursive_factorial.c
│ ├── ex02
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── main.c
│ │ ├── ft_iterative_power2.c
│ │ └── ft_iterative_power.c
│ ├── ex03
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── ft_recursive_power.c
│ │ └── main.c
│ ├── ex04
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── main.c
│ │ └── ft_fibonacci.c
│ └── ex05
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── main.c
│ │ └── ft_sqrt.c
├── j05
│ ├── ex00
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strcpy.c
│ │ └── main.c
│ ├── ex01
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strncpy.c
│ │ └── main.c
│ ├── ex02
│ │ ├── prog
│ │ ├── ft_putchar.c
│ │ ├── ft_putstr.c
│ │ ├── ft_strstr.c
│ │ └── main.c
│ ├── ex03
│ │ ├── prog
│ │ ├── ft_strcmp.c
│ │ └── main.c
│ ├── ex04
│ │ ├── prog
│ │ ├── ft_strncmp.c
│ │ └── main.c
│ ├── ex05
│ │ ├── prog
│ │ ├── ft_strupcase.c
│ │ └── main.c
│ ├── ex06
│ │ ├── prog
│ │ ├── ft_strlowcase.c
│ │ └── main.c
│ ├── ex13
│ │ ├── a.out.dSYM
│ │ │ └── Contents
│ │ │ │ └── Info.plist
│ │ ├── ft_strcat.c
│ │ └── main.c
│ ├── ex17
│ │ ├── ft_putnbr_base.c
│ │ └── main.c
│ ├── ex09
│ │ ├── ft_str_is_numeric.c
│ │ └── main.c
│ ├── ex10
│ │ ├── ft_str_is_lowercase.c
│ │ └── main.c
│ ├── ex11
│ │ ├── ft_str_is_uppercase.c
│ │ └── main.c
│ ├── ex12
│ │ ├── ft_str_is_printable.c
│ │ └── main.c
│ ├── ex08
│ │ ├── ft_str_is_alpha.c
│ │ └── main.c
│ ├── ex07
│ │ ├── main.c
│ │ └── ft_strcapitalize.c
│ ├── ex14
│ │ ├── ft_strncat.c
│ │ └── main.c
│ ├── ex16
│ │ ├── ft_strlcpy.c
│ │ └── main.c
│ └── ex15
│ │ ├── ft_strlcat.c
│ │ └── main.c
├── j07
│ ├── .main.c.swo
│ ├── ex01
│ │ ├── .ft_range.c.swo
│ │ └── ft_range.c
│ ├── a.out.dSYM
│ │ └── Contents
│ │ │ └── Info.plist
│ ├── ex00
│ │ └── ft_strdup.c
│ ├── ex02
│ │ └── ft_ultimate_range.c
│ ├── ex04
│ │ └── ft_split_whitespaces.c
│ ├── ex03
│ │ └── ft_concat_params.c
│ └── main.c
├── mini-projet00
│ ├── prog
│ ├── sastantua
│ ├── prog.c
│ └── sastantua.c
├── j08
│ ├── ex01
│ │ ├── ft_boolean.h.gch
│ │ ├── ft_boolean.h
│ │ └── main.c
│ ├── ex02
│ │ └── ft_abs.h
│ ├── ex03
│ │ ├── ft_point.h
│ │ └── main.c
│ ├── ft.h
│ ├── ex00
│ │ └── ft.h
│ ├── main2.c
│ ├── ex04
│ │ ├── ft_stock_par.h
│ │ ├── ft_split_whitespaces.c
│ │ └── ft_param_to_tab.c
│ └── main.c
├── mini-projet01
│ ├── .main.c.swo
│ ├── ft.h
│ ├── main.c
│ ├── ex00
│ │ └── match.c
│ └── ex01
│ │ └── nmatch.c
└── j10
│ └── ex00
│ ├── src
│ ├── ft_putchar.c
│ ├── ft_swap.c
│ ├── ft_strlen.c
│ ├── ft_putstr.c
│ └── ft_strcmp.c
│ ├── includes
│ └── ft.h
│ └── Makefile
└── README.md
/source/j00/ex02/test3:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/source/j00/ex02/test4:
--------------------------------------------------------------------------------
1 | a
2 |
--------------------------------------------------------------------------------
/source/j00/ex02/test5:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/source/j00/ex02/test6:
--------------------------------------------------------------------------------
1 | test0
--------------------------------------------------------------------------------
/source/j00/ex02/test1:
--------------------------------------------------------------------------------
1 | aaa
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 42
2 | ==
3 |
4 | 42 School
5 |
--------------------------------------------------------------------------------
/source/j01/ex05/"\?$*’KwaMe’*$?\":
--------------------------------------------------------------------------------
1 | 42
2 |
--------------------------------------------------------------------------------
/source/j02/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j02/prog
--------------------------------------------------------------------------------
/source/j03/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/prog
--------------------------------------------------------------------------------
/source/j03/test:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/test
--------------------------------------------------------------------------------
/source/j03/test2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/test2
--------------------------------------------------------------------------------
/source/j06/ex00-source/libft_creator.sh:
--------------------------------------------------------------------------------
1 | gcc -c *.c
2 | ar rc libft.a *.o
3 |
--------------------------------------------------------------------------------
/source/j03/ex00/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex00/prog
--------------------------------------------------------------------------------
/source/j03/ex01/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex01/prog
--------------------------------------------------------------------------------
/source/j03/ex02/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex02/prog
--------------------------------------------------------------------------------
/source/j03/ex04/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex04/prog
--------------------------------------------------------------------------------
/source/j03/ex05/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex05/prog
--------------------------------------------------------------------------------
/source/j03/ex06/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex06/prog
--------------------------------------------------------------------------------
/source/j03/ex07/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex07/prog
--------------------------------------------------------------------------------
/source/j03/ex08/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex08/prog
--------------------------------------------------------------------------------
/source/j04/ex00/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex00/prog
--------------------------------------------------------------------------------
/source/j04/ex01/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex01/prog
--------------------------------------------------------------------------------
/source/j04/ex02/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex02/prog
--------------------------------------------------------------------------------
/source/j04/ex03/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex03/prog
--------------------------------------------------------------------------------
/source/j04/ex04/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex04/prog
--------------------------------------------------------------------------------
/source/j04/ex05/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j04/ex05/prog
--------------------------------------------------------------------------------
/source/j05/ex00/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex00/prog
--------------------------------------------------------------------------------
/source/j05/ex01/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex01/prog
--------------------------------------------------------------------------------
/source/j05/ex02/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex02/prog
--------------------------------------------------------------------------------
/source/j05/ex03/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex03/prog
--------------------------------------------------------------------------------
/source/j05/ex04/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex04/prog
--------------------------------------------------------------------------------
/source/j05/ex05/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex05/prog
--------------------------------------------------------------------------------
/source/j05/ex06/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j05/ex06/prog
--------------------------------------------------------------------------------
/source/j06/ex00/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j06/ex00/prog
--------------------------------------------------------------------------------
/source/j03/ex07-2/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex07-2/prog
--------------------------------------------------------------------------------
/source/j07/.main.c.swo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j07/.main.c.swo
--------------------------------------------------------------------------------
/source/mini-projet00/prog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/mini-projet00/prog
--------------------------------------------------------------------------------
/source/j07/ex01/.ft_range.c.swo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j07/ex01/.ft_range.c.swo
--------------------------------------------------------------------------------
/source/mini-projet00/sastantua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/mini-projet00/sastantua
--------------------------------------------------------------------------------
/source/j03/ex07-2/.ft_strrev.c.swo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j03/ex07-2/.ft_strrev.c.swo
--------------------------------------------------------------------------------
/source/j08/ex01/ft_boolean.h.gch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/j08/ex01/ft_boolean.h.gch
--------------------------------------------------------------------------------
/source/mini-projet01/.main.c.swo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/st3w4r/42/HEAD/source/mini-projet01/.main.c.swo
--------------------------------------------------------------------------------
/source/j00/ex09/a:
--------------------------------------------------------------------------------
1 | STARWARS
2 | Episode IV, A NEW HOPE It is a period of civil war.
3 |
4 | Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.
5 | During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR,
6 | an armored space station with enough power to destroy an entire planet.
7 |
8 | Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy...
9 |
10 |
--------------------------------------------------------------------------------
/source/j00/ex09/b:
--------------------------------------------------------------------------------
1 | Episode V, A NEW H0PE It is a period of civil war
2 | Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.
3 | During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the STAR DEATH, an armored space station with enough power to destroy an entire planet.
4 |
5 |
6 | Pursued by the Empire's sinister agents,
7 | Princess Mehdi races home aboard her starship, custodian of the stolen plans that can save her people and restore the dictatorship to the galaxie..
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/source/j07/a.out.dSYM/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleIdentifier
8 | com.apple.xcode.dsym.a.out
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundlePackageType
12 | dSYM
13 | CFBundleSignature
14 | ????
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleVersion
18 | 1
19 |
20 |
21 |
--------------------------------------------------------------------------------
/source/j05/ex13/a.out.dSYM/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleIdentifier
8 | com.apple.xcode.dsym.a.out
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundlePackageType
12 | dSYM
13 | CFBundleSignature
14 | ????
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleVersion
18 | 1
19 |
20 |
21 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_putnbr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putnbr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 13:21:34 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 17:13:24 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_putchar()
14 |
--------------------------------------------------------------------------------
/source/j03/ft_ft.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ft.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 12:13:15 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 12:27:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ft(int *nbr)
13 | {
14 | *nbr = 42;
15 | }
16 |
--------------------------------------------------------------------------------
/source/j03/ex00/ft_ft.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ft.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 12:13:15 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 12:27:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ft(int *nbr)
13 | {
14 | *nbr = 42;
15 | }
16 |
--------------------------------------------------------------------------------
/source/j05/ex17/ft_putnbr_base.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putnbr_base.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 23:11:54 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 23:24:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_putnbr_base(int nbr, char *base)
14 | {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/source/j03/ft_ultimate_ft.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ultimate_ft.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 12:45:50 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 13:53:22 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ultimate_ft(int *********nbr)
13 | {
14 | *********nbr = 42;
15 | }
16 |
--------------------------------------------------------------------------------
/source/j03/ex01/ft_ultimate_ft.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ultimate_ft.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 12:45:50 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 22:23:52 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ultimate_ft(int *********nbr)
13 | {
14 | *********nbr = 42;
15 | }
16 |
--------------------------------------------------------------------------------
/source/j05/ex00/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:17:08 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | void ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | }
18 |
--------------------------------------------------------------------------------
/source/j05/ex01/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:17:08 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | void ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | }
18 |
--------------------------------------------------------------------------------
/source/j05/ex02/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:17:08 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | void ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | }
18 |
--------------------------------------------------------------------------------
/source/j08/ex02/ft_abs.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_abs.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 12:21:20 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 13:21:16 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #ifndef FT_ABS_H
14 | # define FT_ABS_H
15 | # define ABS(x) (x > 0 ? x : -x)
16 | #endif
17 |
--------------------------------------------------------------------------------
/source/j10/ex00/src/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:17:08 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | void ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | }
18 |
--------------------------------------------------------------------------------
/source/j03/ft_div_mod.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_div_mod.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 14:57:03 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 15:49:47 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_div_mod(int a, int b, int *div, int *mod)
13 | {
14 | *div = a / b;
15 | *mod = a % b;
16 | }
17 |
--------------------------------------------------------------------------------
/source/j05/ex17/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 23:12:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 23:15:29 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_putnbr_base(int nbr, char *base);
14 |
15 | int main(void)
16 | {
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:17:08 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | void ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | }
18 |
--------------------------------------------------------------------------------
/source/j03/ex02/ft_div_mod.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_div_mod.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 14:57:03 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 15:49:47 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_div_mod(int a, int b, int *div, int *mod)
13 | {
14 | *div = a / b;
15 | *mod = a % b;
16 | }
17 |
--------------------------------------------------------------------------------
/source/j04/ex00/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j04/ex01/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j04/ex02/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j04/ex03/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j04/ex04/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j04/ex05/ft_putchar.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putchar.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:21:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 10:24:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putchar(char c)
15 | {
16 | write(1, &c, 1);
17 | return (0);
18 | }
19 |
--------------------------------------------------------------------------------
/source/j03/ex06/ft_swap.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_swap.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:46:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:51:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_swap(int *a, int *b)
14 | {
15 | int tmp_a;
16 |
17 | tmp_a = *a;
18 | *a = *b;
19 | *b = tmp_a;
20 | }
21 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_swap.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_swap.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:46:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:51:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_swap(int *a, int *b)
14 | {
15 | int tmp_a;
16 |
17 | tmp_a = *a;
18 | *a = *b;
19 | *b = tmp_a;
20 | }
21 |
--------------------------------------------------------------------------------
/source/j10/ex00/src/ft_swap.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_swap.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:46:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:51:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | void ft_swap(int *a, int *b)
14 | {
15 | int tmp_a;
16 |
17 | tmp_a = *a;
18 | *a = *b;
19 | *b = tmp_a;
20 | }
21 |
--------------------------------------------------------------------------------
/source/j08/ex03/ft_point.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_point.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 12:34:38 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 12:45:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #ifndef FT_POINT_H
14 | # define FT_POINT_H
15 | typedef struct s_point {
16 | int x;
17 | int y;
18 | } t_point;
19 | #endif
20 |
--------------------------------------------------------------------------------
/source/j03/ex03/ft_ultimate_div_mod.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ultimate_div_mod.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 16:02:45 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 11:28:24 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ultimate_div_mod(int *a, int *b)
13 | {
14 | int tmp_a;
15 |
16 | tmp_a = *a;
17 | *a = *a / *b;
18 | *b = tmp_a % *b;
19 | }
20 |
--------------------------------------------------------------------------------
/source/j06/ex00/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 11:12:06 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 12:13:57 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int main(void)
14 | {
15 |
16 | ft_putstr("Hello world !");
17 | printf("%d \n", ft_strlen("Salut"));
18 | return (0);
19 | }
20 |
--------------------------------------------------------------------------------
/source/j03/ex05/ft_strlen.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlen.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:02:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:32:46 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strlen(char *str)
14 | {
15 | int counter;
16 |
17 | counter = 0;
18 | while (str[counter] != '\0')
19 | {
20 | counter++;
21 | }
22 | return (counter);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j02/ft_print_alphabet.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_print_alphabet.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 15:34:03 by ybarbier #+# #+# */
9 | /* Updated: 2014/07/31 17:41:47 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | int ft_putchar(char c);
13 |
14 | void ft_print_alphabet(void)
15 | {
16 | int i;
17 |
18 | i = 'a';
19 | while (i <= 'z')
20 | {
21 | ft_putchar(i);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j03/ft_ultimate_div_mod.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ultimate_div_mod.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/01 16:02:45 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 22:53:16 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_ultimate_div_mod(int *a, int *b)
13 | {
14 | int tmp_a;
15 | int tmp_b;
16 |
17 | tmp_a = *a;
18 | tmp_b = *b;
19 | *a = tmp_a / tmp_b;
20 | *b = tmp_a % tmp_b;
21 | }
22 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_strlen.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlen.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:02:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:32:46 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strlen(char *str)
14 | {
15 | int counter;
16 |
17 | counter = 0;
18 | while (str[counter] != '\0')
19 | {
20 | counter++;
21 | }
22 | return (counter);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j10/ex00/src/ft_strlen.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlen.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 13:02:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:32:46 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strlen(char *str)
14 | {
15 | int counter;
16 |
17 | counter = 0;
18 | while (str[counter] != '\0')
19 | {
20 | counter++;
21 | }
22 | return (counter);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j03/ex04/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 10:57:21 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | int ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex00/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex01/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex02/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex03/ft_strcmp.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcmp.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 21:37:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 22:59:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strcmp(char *s1, char *s2)
14 | {
15 | int i;
16 |
17 | i = 0;
18 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
19 | i++;
20 | return (s1[i] - s2[i]);
21 | }
22 |
--------------------------------------------------------------------------------
/source/j04/ex05/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 20:47:43 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_sqrt(int nb);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_sqrt(49);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j06/ex00-source/ft_strcmp.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcmp.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 21:37:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 22:59:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strcmp(char *s1, char *s2)
14 | {
15 | int i;
16 |
17 | i = 0;
18 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
19 | i++;
20 | return (s1[i] - s2[i]);
21 | }
22 |
--------------------------------------------------------------------------------
/source/j10/ex00/src/ft_putstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_putstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:30:26 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 10:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/source/j10/ex00/src/ft_strcmp.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcmp.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 21:37:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 22:59:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strcmp(char *s1, char *s2)
14 | {
15 | int i;
16 |
17 | i = 0;
18 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
19 | i++;
20 | return (s1[i] - s2[i]);
21 | }
22 |
--------------------------------------------------------------------------------
/source/j05/ex09/ft_str_is_numeric.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_str_is_numeric.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 16:02:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:08:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_str_is_numeric(char *str)
14 | {
15 | while (str[0] != '\0')
16 | {
17 | if (!(str[0] >= '0' && str[0] <= '9'))
18 | return (0);
19 | str++;
20 | }
21 | return (1);
22 | }
23 |
--------------------------------------------------------------------------------
/source/j08/ft.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 23:59:36 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 11:42:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_H
13 | # define FT_H
14 | void ft_putchar(char c);
15 | void ft_putstr(char *str);
16 | void ft_swap(int *a, int *b);
17 | int ft_strcmp(char *s1, char s2);
18 | int ft_strlen(char *str);
19 | #endif
20 |
--------------------------------------------------------------------------------
/source/j04/ex04/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 18:45:28 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_fibonacci(int index);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_fibonacci(5);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j05/ex10/ft_str_is_lowercase.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_str_is_lowercase.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 16:20:51 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:28:59 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_str_is_lowercase(char *str)
14 | {
15 | while (str[0] != '\0')
16 | {
17 | if (!(str[0] >= 'a' && str[0] <= 'z'))
18 | return (0);
19 | str++;
20 | }
21 | return (1);
22 | }
23 |
--------------------------------------------------------------------------------
/source/j05/ex11/ft_str_is_uppercase.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_str_is_uppercase.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 16:31:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:36:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_str_is_uppercase(char *str)
14 | {
15 | while (str[0] != '\0')
16 | {
17 | if (!(str[0] >= 'A' && str[0] <= 'Z'))
18 | return (0);
19 | str++;
20 | }
21 | return (1);
22 | }
23 |
--------------------------------------------------------------------------------
/source/j05/ex12/ft_str_is_printable.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_str_is_printable.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 16:43:03 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:52:24 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_str_is_printable(char *str)
14 | {
15 | while (str[0] != '\0')
16 | {
17 | if (!(str[0] >= 32 && str[0] <= 126))
18 | return (0);
19 | str++;
20 | }
21 | return (1);
22 | }
23 |
--------------------------------------------------------------------------------
/source/j06/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 11:12:06 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/08 09:28:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | void ft_putstr(char *str);
14 | int ft_strlen(char *str);
15 | int main(void)
16 | {
17 |
18 | ft_putstr("Hello world !");
19 | printf("%d \n", ft_strlen("Salut"));
20 | return (0);
21 | }
22 |
--------------------------------------------------------------------------------
/source/j08/ex00/ft.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 23:59:36 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 11:42:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_H
13 | # define FT_H
14 | void ft_putchar(char c);
15 | void ft_putstr(char *str);
16 | void ft_swap(int *a, int *b);
17 | int ft_strcmp(char *s1, char s2);
18 | int ft_strlen(char *str);
19 | #endif
20 |
--------------------------------------------------------------------------------
/source/j04/ex04/ft_fibonacci.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_fibonacci.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 18:33:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 18:45:19 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | int ft_fibonacci(int index)
13 | {
14 | if (index < 1)
15 | return (0);
16 | else if (index <= 1)
17 | return (index);
18 | else
19 | return (ft_fibonacci(index - 1) + ft_fibonacci(index - 2));
20 | }
21 |
--------------------------------------------------------------------------------
/source/j05/ex00/ft_strcpy.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcpy.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:10:39 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 14:31:48 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | char *ft_strcpy(char *dest, char *src)
13 | {
14 | int i;
15 |
16 | i = 0;
17 | while (src[i] != '\0')
18 | {
19 | dest[i] = src[i];
20 | i++;
21 | }
22 | dest[i] = '\0';
23 | return (dest);
24 | }
25 |
--------------------------------------------------------------------------------
/source/mini-projet01/ft.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 23:59:36 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 11:42:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_H
13 | # define FT_H
14 | void ft_putchar(char c);
15 | void ft_putstr(char *str);
16 | void ft_swap(int *a, int *b);
17 | int ft_strcmp(char *s1, char s2);
18 | int ft_strlen(char *str);
19 | #endif
20 |
--------------------------------------------------------------------------------
/source/j10/ex00/includes/ft.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 23:59:36 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 11:42:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_H
13 | # define FT_H
14 | void ft_putchar(char c);
15 | void ft_putstr(char *str);
16 | void ft_swap(int *a, int *b);
17 | int ft_strcmp(char *s1, char s2);
18 | int ft_strlen(char *str);
19 | #endif
20 |
--------------------------------------------------------------------------------
/source/j04/ex03/ft_recursive_power.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_recursive_power.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 17:43:17 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 18:03:39 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_recursive_power(int nb, int power)
14 | {
15 | if (power < 0)
16 | return (0);
17 | else if (power < 1)
18 | return (1);
19 | else
20 | return (nb * ft_recursive_power(nb, power - 1));
21 | }
22 |
--------------------------------------------------------------------------------
/source/j03/ex04/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 10:57:54 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 |
14 | void ft_putstr(char *str);
15 |
16 | int main(void)
17 | {
18 | ft_putstr("Ok 42");
19 | return (0);
20 | }
21 |
22 | int ft_putchar(char c)
23 | {
24 | write(1, &c, 1);
25 | return 0;
26 | }
27 |
--------------------------------------------------------------------------------
/source/j04/ex00/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 13:05:06 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_iterative_factorial(int nb);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_iterative_factorial(0);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex01/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 13:04:45 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_recursive_factorial(int nb);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_recursive_factorial(0);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j05/ex05/ft_strupcase.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strupcase.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 12:45:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 13:01:46 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strupcase(char *str)
14 | {
15 | int i;
16 |
17 | i = 0;
18 | while (str[i] != '\0')
19 | {
20 | if (str[i] >= 'a' && str[i] <= 'z')
21 | str[i] -= 32;
22 | i++;
23 | }
24 | return (str);
25 | }
26 |
--------------------------------------------------------------------------------
/source/j05/ex06/ft_strlowcase.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlowcase.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:11:55 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 13:16:01 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strlowcase(char *str)
14 | {
15 | int i;
16 |
17 | i = 0;
18 | while (str[i] != '\0')
19 | {
20 | if (str[i] >= 'A' && str[i] <= 'Z')
21 | str[i] += 32;
22 | i++;
23 | }
24 | return (str);
25 | }
26 |
--------------------------------------------------------------------------------
/source/j04/ex00/ft_iterative_factorial.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_iterative_factorial.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:16:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 12:17:23 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_iterative_factorial(int nb)
14 | {
15 | int i;
16 |
17 | if (nb < 1)
18 | return (0);
19 | i = nb;
20 | while (i > 1)
21 | {
22 | nb = nb * (i - 1);
23 | i--;
24 | }
25 | return (nb);
26 | }
27 |
--------------------------------------------------------------------------------
/source/j04/ex03/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 18:02:11 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_recursive_power(int nb, int power);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_recursive_power(2, 4);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex02/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 10:18:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 10:53:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | int ft_iterative_power(int nb, int power);
14 | int ft_putchar(void);
15 |
16 | int main(void)
17 | {
18 | int nb;
19 |
20 | nb = ft_iterative_power(30, 122);
21 | printf("%d", nb);
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex01/ft_recursive_factorial.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_recursive_factorial.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 12:32:15 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 13:11:03 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_recursive_factorial(int nb)
14 | {
15 | if (nb < 1)
16 | return (0);
17 | else if (nb == 1)
18 | {
19 | return (1);
20 | }
21 | else
22 | {
23 | return (nb * ft_recursive_factorial(nb - 1));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/source/j05/ex01/ft_strncpy.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strncpy.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 13:38:43 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 14:23:40 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | char *ft_strncpy(char *dest, char *src, unsigned int n)
13 | {
14 | unsigned int i;
15 |
16 | i = 0;
17 | while (src != '\0' && (i < n))
18 | {
19 | dest[i] = src[i];
20 | i++;
21 | }
22 | dest[i] = '\0';
23 | return (dest);
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex08/ft_str_is_alpha.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_str_is_alpha.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 15:33:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:08:42 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_str_is_alpha(char *str)
14 | {
15 | while (str[0] != '\0')
16 | {
17 | if (!((str[0] >= 'A' && str[0] <= 'Z') ||
18 | (str[0] >= 'a' && str[0] <= 'z')))
19 | return (0);
20 | str++;
21 | }
22 | return (1);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j00/ex09/sw.diff:
--------------------------------------------------------------------------------
1 | 1,2c1,8
2 | < STARWARS
3 | < Episode IV, A NEW HOPE It is a period of civil war.
4 | ---
5 | > Episode V, A NEW H0PE It is a period of civil war
6 | > Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.
7 | > During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the STAR DEATH, an armored space station with enough power to destroy an entire planet.
8 | >
9 | >
10 | > Pursued by the Empire's sinister agents,
11 | > Princess Mehdi races home aboard her starship, custodian of the stolen plans that can save her people and restore the dictatorship to the galaxie..
12 | >
13 | 4,6d9
14 | < Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.
15 | < During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR,
16 | < an armored space station with enough power to destroy an entire planet.
17 | 8d10
18 | < Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy...
19 |
--------------------------------------------------------------------------------
/source/j08/main2.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 11:12:06 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/11 23:30:50 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include "ft.h"
13 | #include "ex02/ft_abs.h"
14 | #include "ex04/ft_stock_par.h"
15 |
16 | int main(int argc, char **argv)
17 | {
18 | // ft_putchar(ABS('A'));
19 | t_stock_par s_stock;
20 | s_stock = ft_param_to_tab(argc, argv);
21 | return (0);
22 | }
23 |
--------------------------------------------------------------------------------
/source/j05/ex04/ft_strncmp.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strncmp.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 23:07:49 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 23:48:53 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_strncmp(char *s1, char *s2, unsigned int n)
14 | {
15 | unsigned int i;
16 |
17 | i = 0;
18 | if (n == 0)
19 | return (0);
20 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0' && i < n - 1)
21 | i++;
22 | return (s1[i] - s2[i]);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex02/ft_iterative_power2.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_iterative_power.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 13:38:02 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 17:33:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_iterative_power(int nb, int power)
14 | {
15 | int i;
16 | int total;
17 |
18 | if (power < 0)
19 | return (0);
20 | i = 0;
21 | total = 1;
22 | while (i < power)
23 | {
24 | total *= nb;
25 | i++;
26 | }
27 | return (total);
28 | }
29 |
--------------------------------------------------------------------------------
/source/j08/ex03/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 12:37:17 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 12:44:24 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include "ft_point.h"
13 | #include
14 | void set_point(t_point *point)
15 | {
16 | point->x = 42;
17 | point->y = 21;
18 | }
19 | int main(void)
20 | {
21 | t_point point;
22 | set_point(&point);
23 | printf("x: %d y: %d", point.x, point.y);
24 | return (0);
25 | }
26 |
--------------------------------------------------------------------------------
/source/j05/ex05/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 13:07:54 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strupcase(char *str);
16 |
17 | int main(void)
18 | {
19 | char str1[] = "Salut les gars Comment WWwww 000 !";
20 | printf("Original: %s ", str1);
21 | printf("Final: %s ", ft_strupcase(str1));
22 |
23 | return (0);
24 | }
25 |
--------------------------------------------------------------------------------
/source/j05/ex13/ft_strcat.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcat.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 17:42:38 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 20:50:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strcat(char *dest, char *src)
14 | {
15 | int i;
16 | int j;
17 |
18 | i = 0;
19 | while (dest[i] != '\0')
20 | i++;
21 | j = 0;
22 | while (src[j] != '\0')
23 | {
24 | dest[i + j] = src[j];
25 | j++;
26 | }
27 | dest[i + j] = '\0';
28 | return (dest);
29 | }
30 |
--------------------------------------------------------------------------------
/source/mini-projet01/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 23:10:05 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/10 17:30:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include "ft.h"
13 |
14 | int match(char *s1, char *s2);
15 | int nmatch(char *s1, char *s2);
16 |
17 | int main(int argc, char **argv)
18 | {
19 | int i;
20 |
21 | if (argc != 3)
22 | return (0);
23 | i = nmatch(argv[1], argv[2]);
24 | ft_putchar(i + '0');
25 | return (0);
26 | }
27 |
--------------------------------------------------------------------------------
/source/j05/ex08/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:18:33 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | int ft_str_is_alpha(char *str);
15 |
16 | int main(void)
17 | {
18 | // char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | char str[] = "";
20 | // printf("%d \n", str);
21 | printf("%d", ft_str_is_alpha(str));
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex05/ft_sqrt.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_sqrt.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 19:02:43 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 20:47:48 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_sqrt(int nb)
14 | {
15 | int racine;
16 | int sqrt;
17 |
18 | racine = 1;
19 | sqrt = 0;
20 | while (racine <= nb / 2)
21 | {
22 | sqrt = racine * racine;
23 | if (sqrt == nb)
24 | {
25 | return (racine);
26 | }
27 | racine = racine + 1;
28 | }
29 | return (0);
30 | }
31 |
--------------------------------------------------------------------------------
/source/j05/ex07/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 15:18:29 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | char *ft_strcapitalize(char *str);
15 |
16 | int main(void)
17 | {
18 | char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | // char str[] = "SALUT";
20 | printf("%s \n", str);
21 | printf("%s", ft_strcapitalize(str));
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j05/ex09/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:08:50 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | int ft_str_is_numeric(char *str);
15 |
16 | int main(void)
17 | {
18 | // char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | char str[] = "";
20 | // printf("%d \n", str);
21 | printf("%d", ft_str_is_numeric(str));
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j04/ex02/ft_iterative_power.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_iterative_power.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: fvial +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 19:43:00 by fvial #+# #+# */
9 | /* Updated: 2014/08/05 11:40:20 by fvial ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int ft_iterative_power(int nb, int power)
14 | {
15 | int i;
16 | int nbr;
17 |
18 | i = 1;
19 | nbr = nb;
20 | if (power == 0)
21 | return (1);
22 | if (power < 0)
23 | return (0);
24 | while (i < power)
25 | {
26 | nb = nb * nbr;
27 | i++;
28 | }
29 | return (nb);
30 | }
31 |
--------------------------------------------------------------------------------
/source/j05/ex10/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:26:23 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | int ft_str_is_lowercase(char *str);
15 |
16 | int main(void)
17 | {
18 | // char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | char str[] = "";
20 | // printf("%d \n", str);
21 | printf("%d", ft_str_is_lowercase(str));
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j05/ex11/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:36:34 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | int ft_str_is_uppercase(char *str);
15 |
16 | int main(void)
17 | {
18 | // char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | char str[] = "AA";
20 | // printf("%d \n", str);
21 | printf("%d", ft_str_is_uppercase(str));
22 | return (0);
23 | }
24 |
--------------------------------------------------------------------------------
/source/j08/ex04/ft_stock_par.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_stock_par.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 12:53:13 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/11 23:58:30 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_STOCK_PAR_H
13 | # define FT_STOCK_PAR_H
14 | # include
15 | char **ft_split_whitespaces(char *str);
16 | char *ft_strdup(char *src);
17 | typedef struct s_stock_par
18 | {
19 | int size_param;
20 | char *str;
21 | char *copy;
22 | char **tab;
23 | } t_stock_par;
24 | #endif
25 |
--------------------------------------------------------------------------------
/source/j05/ex14/ft_strncat.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strncat.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 21:20:16 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 21:28:00 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strncat(char *dest, char *src, int nb)
14 | {
15 | int i;
16 | int j;
17 |
18 | i = 0;
19 | while (dest[i] != '\0')
20 | i++;
21 | j = 0;
22 | while (src[j] != '\0' && j < nb)
23 | {
24 | dest[i + j] = src[j];
25 | j++;
26 | }
27 | dest[i + j] = '\0';
28 | return (dest);
29 | }
30 |
--------------------------------------------------------------------------------
/source/j05/ex06/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 13:11:13 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strlowcase(char *str);
16 |
17 | int main(void)
18 | {
19 | char str1[] = "Salut les gars Connent ))0as3223412334@$!@#$#@ $3241`123 '0 OOO ooo !";
20 | printf("Original: %s ", str1);
21 | printf("Final: %s ", ft_strlowcase(str1));
22 |
23 | return (0);
24 | }
25 |
--------------------------------------------------------------------------------
/source/j07/ex01/ft_range.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_range.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 21:10:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/08 10:38:27 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int *ft_range(int min, int max)
15 | {
16 | int *tab;
17 | int i;
18 |
19 | if (min >= max)
20 | return (NULL);
21 | tab = (int*)malloc(sizeof(*tab) * (max - min));
22 | i = 0;
23 | while (min < max)
24 | {
25 | tab[i] = min;
26 | i++;
27 | min++;
28 | }
29 | return (tab);
30 | }
31 |
--------------------------------------------------------------------------------
/source/j07/ex00/ft_strdup.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strdup.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 16:58:15 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/07 22:21:06 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | char *ft_strdup(char *src)
15 | {
16 | int i;
17 | int len;
18 | char *str;
19 |
20 | len = 0;
21 | while (src[len])
22 | len++;
23 | str = (char*)malloc(sizeof(*str) * (len + 1));
24 | i = 0;
25 | while (i < len)
26 | {
27 | str[i] = src[i];
28 | i++;
29 | }
30 | return (str);
31 | }
32 |
--------------------------------------------------------------------------------
/source/j08/ex01/ft_boolean.h:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_boolean.h :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 11:17:30 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 12:09:58 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #ifndef FT_BOOLEAN_H
13 | # define FT_BOOLEAN_H
14 | # include
15 | # define EVEN(x) x % 2 == 0
16 | # define EVEN_MSG "I have a pair number of arguments."
17 | # define ODD_MSG "I have an impair number of arguments."
18 | # define TRUE 1
19 | # define FALSE 0
20 | # define SUCCESS 0
21 | typedef int t_bool;
22 | #endif
23 |
--------------------------------------------------------------------------------
/source/j06/ex01/ft_print_program_name.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_print_program_name.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 18:48:13 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/07 12:39:57 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
26 | int main(int argc, char **argv)
27 | {
28 | (void)argc;
29 | ft_putstr(argv[0]);
30 | ft_putchar('\n');
31 | return (0);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j05/ex02/ft_strstr.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strstr.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 16:01:11 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 21:01:28 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strstr(char *str, char *to_find)
14 | {
15 | int i;
16 | int j;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | j = 0;
22 | while (to_find[j] == str[i + j])
23 | {
24 | if (to_find[j + 1] == '\0')
25 | {
26 | return (str + i);
27 | }
28 | j++;
29 | }
30 | i++;
31 | }
32 | return (0);
33 | }
34 |
--------------------------------------------------------------------------------
/source/j05/ex02/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 19:35:56 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strstr(char *src, char *to_find);
16 |
17 | int main(void)
18 | {
19 | char str_src[] = "Helloa";
20 | char str_find[] = "lo";
21 |
22 | printf("Text: %s ", ft_strstr(str_src, str_find));
23 | printf("src: %s ", str_src);
24 | printf("Search: %s ", str_find);
25 | return (0);
26 | }
27 |
--------------------------------------------------------------------------------
/source/j03/ex00/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 22:00:04 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 | #include
14 |
15 | void ft_putstr(char *str);
16 | void ft_ft(int *nbr);
17 | int main(void)
18 | {
19 | int a;
20 |
21 | a = 3;
22 | printf("%d", a);
23 | ft_ft(&a);
24 | printf(" %d", a);
25 |
26 |
27 | return (0);
28 | }
29 |
30 | int ft_putchar(char c)
31 | {
32 | write(1, &c, 1);
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/source/j03/ex05/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 13:30:26 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 |
14 | int ft_strlen(char *str);
15 | int ft_putchar(char c);
16 |
17 | int main(void)
18 | {
19 | char text[] = "123456789";
20 | char *str;
21 | int len;
22 |
23 | str = &text[0];
24 |
25 | len = ft_strlen(str);
26 | ft_putchar(len + '0');
27 | return (0);
28 | }
29 |
30 | int ft_putchar(char c)
31 | {
32 | write(1, &c, 1);
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/source/j03/ex07-2/ft_strrev.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strrev.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 19:58:01 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 16:03:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | char *ft_strrev(char *str)
13 | {
14 | int count;
15 | int len;
16 | int ascii;
17 |
18 | len = 0;
19 | while (str[len] != '\0')
20 | {
21 | len++;
22 | }
23 | count = 0;
24 | while (count < len / 2)
25 | {
26 | ascii = str[count];
27 | str[count] = str[len - count - 1];
28 | str[len - count - 1] = ascii;
29 | count++;
30 | }
31 | return (str);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j05/ex16/ft_strlcpy.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlcpy.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 22:40:25 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 23:01:35 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
14 | {
15 | unsigned int i;
16 | unsigned int j;
17 |
18 | i = 0;
19 | while (dest[i] != '\0')
20 | i++;
21 | j = 0;
22 | while (src[j] != '\0' && j < size)
23 | {
24 | dest[i + j] = src[j];
25 | j++;
26 | }
27 | dest[i + j] = '\0';
28 | i = 0;
29 | while (src[i])
30 | i++;
31 | return (i);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j06/ex02/ft_print_params.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_print_params.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 01:19:33 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/07 01:43:34 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
26 | int main(int argc, char **argv)
27 | {
28 | int i;
29 |
30 | i = 1;
31 | while (i < argc)
32 | {
33 | ft_putstr(argv[i]);
34 | ft_putchar('\n');
35 | i++;
36 | }
37 | return (0);
38 | }
39 |
--------------------------------------------------------------------------------
/source/j06/ex03/ft_rev_params.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_rev_params.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 01:32:16 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/07 01:44:15 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
26 | int main(int argc, char **argv)
27 | {
28 | int i;
29 |
30 | i = argc - 1;
31 | while (i > 0)
32 | {
33 | ft_putstr(argv[i]);
34 | ft_putchar('\n');
35 | i--;
36 | }
37 | return (0);
38 | }
39 |
--------------------------------------------------------------------------------
/source/mini-projet00/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 18:07:57 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_putint(int a);
16 | int ft_putchar(char c);
17 | void ft_ft(int *nbr);
18 | void sastantua(int size);
19 |
20 | int main()
21 | {
22 | sastantua(5);
23 | return (0);
24 | }
25 |
26 | int ft_putchar(char c)
27 | {
28 | write(1, &c, 1);
29 | return (0);
30 | }
31 |
32 | int ft_putint(int a)
33 | {
34 | write(1, &a, 1);
35 | return (0);
36 | }
37 |
--------------------------------------------------------------------------------
/source/j05/ex01/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 20:37:10 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strcpy(char *dest, char *src);
16 | char *ft_strncpy(char *dest, char *src, unsigned int n);
17 | void ft_putstr(char *str);
18 |
19 | int main(void)
20 | {
21 | char str_src[] = "Hellooooooooooooo";
22 | char str_dest[] = "Salut";
23 |
24 | ft_strncpy(str_dest, str_src, 1);
25 | ft_putstr(str_src);
26 | ft_putstr(str_dest);
27 | return (0);
28 | }
29 |
--------------------------------------------------------------------------------
/source/j07/ex02/ft_ultimate_range.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_ultimate_range.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 11:39:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/08 13:37:03 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_ultimate_range(int **range, int min, int max)
15 | {
16 | int i;
17 | int *tab;
18 |
19 | if (min >= max)
20 | {
21 | *range = (void *)0;
22 | return (0);
23 | }
24 | tab = (int*)malloc(sizeof(*tab) * (max - min));
25 | i = 0;
26 | while (min < max)
27 | {
28 | tab[i] = min;
29 | i++;
30 | min++;
31 | }
32 | *range = tab;
33 | return (i);
34 | }
35 |
--------------------------------------------------------------------------------
/source/j05/ex14/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 21:27:27 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strncat(char *dest, char *src, int nb);
16 |
17 | int main(void)
18 | {
19 | const char src1[10] = "abc";
20 | char dest1[10] = "1234";
21 |
22 | char src[10] = "abc";
23 | char dest[10] = "1234";
24 | //strcat(src, dest);
25 | printf("Str: %s \n", strncat(dest1, src1, 1));
26 | printf("Str: %s", ft_strncat(dest, src, 1));
27 | return (0);
28 | }
29 |
--------------------------------------------------------------------------------
/source/j08/ex01/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 11:10:49 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 11:31:01 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include "ft_boolean.h"
14 |
15 | void ft_putstr(char *str)
16 | {
17 | while (*str)
18 | write(1, str++, 1);
19 | }
20 |
21 | t_bool ft_is_even(int nbr)
22 | {
23 | return ((EVEN(nbr)) ? TRUE : FALSE);
24 | }
25 |
26 | int main(int argc, char **argv)
27 | {
28 | (void)argv;
29 | if (ft_is_even(argc - 1) == TRUE)
30 | ft_putstr(EVEN_MSG);
31 | else
32 | ft_putstr(ODD_MSG);
33 | return (SUCCESS);
34 | }
35 |
--------------------------------------------------------------------------------
/source/j05/ex03/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 23:05:29 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int strcmp(const char *s1, const char *s2);
16 | int ft_strcmp(char *s1, char *s2);
17 |
18 | int main(void)
19 | {
20 | char str1[] = "aaa";
21 | char str2[] = "aaab";
22 |
23 | //printf("Strcmo: %d ", strcmp(str1, str2));
24 | printf("ft_strcmp: %d ", ft_strcmp(str1, str2));
25 | printf("src: %s ", str1);
26 | printf("Search: %s ", str2);
27 | return (0);
28 | }
29 |
--------------------------------------------------------------------------------
/source/j05/ex00/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 20:56:19 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | char *ft_strcpy(char *dest, char *src);
16 | void ft_putstr(char *str);
17 |
18 | int main(void)
19 | {
20 | char str_src[] = "Hello";
21 | char str_dest[] = "Salut";
22 |
23 | printf(" %s ", strcpy(str_dest, str_src));
24 | printf(" %s ", str_dest);
25 | // ft_strcpy(str_dest, str_src);
26 | // ft_putstr(str_src);
27 | // ft_putstr(str_dest);
28 | return (0);
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/source/j05/ex15/ft_strlcat.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strlcat.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 21:41:28 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 22:37:17 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | unsigned int ft_strlcat(char *dest, char *src, unsigned int size)
14 | {
15 | unsigned int i;
16 | unsigned int j;
17 | unsigned int k;
18 |
19 | i = 0;
20 | while (dest[i] != '\0')
21 | i++;
22 | j = 0;
23 | while (src[j] != '\0' && j < size)
24 | {
25 | dest[i + j] = src[j];
26 | j++;
27 | }
28 | dest[i + j] = '\0';
29 | k = 0;
30 | while (src[k] != '\0')
31 | k++;
32 | return (k + size);
33 | }
34 |
--------------------------------------------------------------------------------
/source/j03/ex08/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 21:01:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 23:28:59 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_atoi(char *str);
16 | void putnbr(int n);
17 | void ft_putchar(char c);
18 |
19 | int main(void)
20 | {
21 | int num;
22 | num = 0;
23 | num = atoi("+90123 qwe");
24 | printf("%d", num);
25 | return 0;
26 | }
27 |
28 | void putnbr(int n)
29 | {
30 | if (n >= 10)
31 | {
32 | putnbr(n / 10);
33 | putnbr(n % 10);
34 | }
35 | else
36 | putchar(48 + n);
37 | }
38 |
--------------------------------------------------------------------------------
/source/j03/ex07/ft_strrev.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strrev.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 19:58:01 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 11:08:55 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | char *ft_strrev(char *str)
13 | {
14 | int count;
15 | int len;
16 | char text[2];
17 | char *text_str;
18 |
19 | text[0] = ' ';
20 | text[1] = '\0';
21 | text_str = &text[0];
22 | len = 0;
23 | while (str[len] != '\0')
24 | {
25 | len++;
26 | }
27 | count = 0;
28 | while (count < len)
29 | {
30 | text_str[count] = str[len - count - 1];
31 | count++;
32 | }
33 | text_str[count] = '\0';
34 | return (text_str);
35 | }
36 |
--------------------------------------------------------------------------------
/source/j05/ex12/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:27 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 16:55:14 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | #include
14 | int ft_str_is_printable(char *str);
15 |
16 | int main(void)
17 | {
18 | // char str[] = "salut, COMMENT tU v7As ? 42mots quarante-deux; cinquante+et+un";
19 | // char str[] = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
20 | char str[] = "";
21 | //char str[] = " ";
22 | // printf("%d \n", str);
23 | printf("%d", ft_str_is_printable(str));
24 | return (0);
25 | }
26 |
--------------------------------------------------------------------------------
/source/j05/ex13/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 20:52:28 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | //char *strcat(char *dest, const char *src);
16 | char *ft_strcat(char *dest, char *src);
17 |
18 | int main(void)
19 | {
20 | const char src1[10] = "abc";
21 | char dest1[10] = "123";
22 |
23 | char src[10] = "abc";
24 | char dest[10] = "123";
25 | //strcat(src, dest);
26 | printf("Str: %s \n", strcat(dest1, src1));
27 | printf("Str: %s", ft_strcat(dest, src));
28 | return (0);
29 | }
30 |
--------------------------------------------------------------------------------
/source/mini-projet01/ex00/match.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* match.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 20:09:12 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/10 17:31:43 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int match(char *s1, char *s2)
14 | {
15 | if (!*s1 && !*s2)
16 | return (1);
17 | else if (*s1 == *s2 && *s1 != '*')
18 | return (match(s1 + 1, s2 + 1));
19 | else if (*s1 == '*' && *s2 == '*')
20 | return (match(s1 + 1, s2));
21 | else if (*s2 == '*' && !*s1)
22 | return (match(s1, s2 + 1));
23 | else if (*s2 == '*' && *s2 && *s1)
24 | return (match(s1, s2 + 1) || match(s1 + 1, s2));
25 | else
26 | return (0);
27 | }
28 |
--------------------------------------------------------------------------------
/source/mini-projet01/ex01/nmatch.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* nmatch.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/10 17:28:35 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/10 17:31:41 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | int nmatch(char *s1, char *s2)
14 | {
15 | if (!*s1 && !*s2)
16 | return (1);
17 | else if (*s1 == *s2 && *s1 != '*')
18 | return (nmatch(s1 + 1, s2 + 1));
19 | else if (*s1 == '*' && *s2 == '*')
20 | return (nmatch(s1 + 1, s2));
21 | else if (*s2 == '*' && !*s1)
22 | return (nmatch(s1, s2 + 1));
23 | else if (*s2 == '*' && *s2 && *s1)
24 | return (nmatch(s1, s2 + 1) + nmatch(s1 + 1, s2));
25 | else
26 | return (0);
27 | }
28 |
--------------------------------------------------------------------------------
/source/j03/ex02/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 22:38:39 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putint(int a);
15 | int ft_putchar(char c);
16 | void ft_div_mod(int a, int b, int *div, int *mod);
17 |
18 | int main()
19 | {
20 |
21 | int a;
22 | int b;
23 | int *ptr_div;
24 | int *ptr_mod;
25 | int div;
26 | int mod;
27 |
28 | a = 20;
29 | b = 4;
30 |
31 | ptr_div = ÷
32 | ptr_mod = &mod;
33 |
34 | ft_div_mod(a, b, ptr_div, ptr_mod);
35 | printf("%d ", *ptr_div);
36 | printf("%d", *ptr_mod);
37 |
38 | return (0);
39 | }
40 |
--------------------------------------------------------------------------------
/source/j03/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 12:21:34 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_putint(int a);
16 | int ft_putchar(char c);
17 | void ft_ft(int *nbr);
18 |
19 | int main()
20 | {
21 | int a;
22 | int *b;
23 | a = 50;
24 | b = &a;
25 |
26 | printf("%d",a);
27 | ft_ft(b);
28 | printf("%d",a);
29 |
30 | return (0);
31 | }
32 |
33 | int ft_putchar(char c)
34 | {
35 | write(1, &c, 1);
36 | return (0);
37 | }
38 |
39 | int ft_putint(int a)
40 | {
41 | write(1, &a, 1);
42 | return (0);
43 | }
44 |
--------------------------------------------------------------------------------
/source/j03/ex08/ft_atoi.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_atoi.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/04 21:21:31 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 23:20:48 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | int ft_atoi(char *str)
13 | {
14 | int i;
15 | int len;
16 | int nb;
17 | int mult;
18 | int neg;
19 |
20 | i = 0;
21 | len = 0;
22 | nb = 0;
23 | mult = 1;
24 | neg = 0;
25 | while (str[len] != '\0')
26 | len++;
27 | i = len - 1;
28 | while (str[i] != '\0')
29 | {
30 | if (str[i] >= '0' && str[i] <= '9')
31 | nb += (str[i] - 48) * mult;
32 | if (str[i] == '-')
33 | neg = 1;
34 | mult *= 10;
35 | len--;
36 | i--;
37 | }
38 | return (neg ? -nb : nb);
39 | }
40 |
--------------------------------------------------------------------------------
/source/j03/ex06/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/02 14:05:35 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 |
14 | int ft_putchar(char c);
15 | void ft_swap(int *a, int *b);
16 |
17 | int main(void)
18 | {
19 | int *a;
20 | int *b;
21 | int va;
22 | int vb;
23 |
24 | va = 2;
25 | vb = 4;
26 | a = &va;
27 | b = &vb;
28 |
29 | ft_putchar(*a + '0');
30 | ft_putchar(' ');
31 | ft_putchar(*b + '0');
32 |
33 | ft_swap(a, b);
34 | ft_putchar(*a + '0');
35 | ft_putchar(' ');
36 | ft_putchar(*b + '0');
37 |
38 | return (0);
39 | }
40 |
41 | int ft_putchar(char c)
42 | {
43 | write(1, &c, 1);
44 | return 0;
45 | }
46 |
--------------------------------------------------------------------------------
/source/j05/ex15/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 22:35:54 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | //char *ft_strncat(char *dest, char *src, int nb);
16 | unsigned int ft_strlcat(char *dest, char *src, unsigned int size);
17 |
18 | int main(void)
19 | {
20 | const char src1[10] = "ab";
21 | char dest1[10] = "123";
22 |
23 | char src[10] = "ab";
24 | char dest[10] = "123";
25 |
26 | size_t nb = 2;
27 | unsigned int nb2 = 2;
28 | //strcat(src, dest);
29 | printf("Str: %ld \n", strlcat(dest1, src1, nb));
30 | printf("Str: %u", ft_strlcat(dest, src, nb2));
31 | return (0);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j10/ex00/Makefile:
--------------------------------------------------------------------------------
1 | # **************************************************************************** #
2 | # #
3 | # ::: :::::::: #
4 | # Makefile :+: :+: :+: #
5 | # +:+ +:+ +:+ #
6 | # By: ybarbier +#+ +:+ +#+ #
7 | # +#+#+#+#+#+ +#+ #
8 | # Created: 2014/08/11 17:14:40 by ybarbier #+# #+# #
9 | # Updated: 2014/08/12 00:31:22 by ybarbier ### ########.fr #
10 | # #
11 | # **************************************************************************** #
12 |
13 | NAME = libft.a
14 | PATH_SRC = ./src/
15 | HEADER = ./includes/
16 | FLAG = -Wall -Wextra -Werror
17 | OPTION = -c -I $(HEADER)
18 | SRC = $(PATH_SRC)ft_putchar.c $(PATH_SRC)ft_putstr.c $(PATH_SRC)ft_strcmp.c \
19 | $(PATH_SRC)ft_strlen.c $(PATH_SRC)ft_swap.c
20 | OBJ = ft_putchar.o ft_putstr.o ft_strcmp.o ft_strlen.o ft_swap.o
21 |
22 | all: $(NAME)
23 |
24 | $(NAME):
25 | gcc $(FLAG) $(OPTION) $(SRC)
26 | ar rc $(NAME) $(OBJ)
27 |
28 | clean:
29 | /bin/rm -f $(OBJ)
30 | fclean: clean
31 | /bin/rm -f $(NAME)
32 |
33 | re: fclean all
34 |
35 |
--------------------------------------------------------------------------------
/source/j03/ex07-2/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 15:59:46 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 | #include
14 | int ft_putchar(char c);
15 | int ft_putnbr(int n);
16 | char *ft_strrev(char * str);
17 |
18 | int main(void)
19 | {
20 | char text[] = "Salut";
21 |
22 | printf("%s", ft_strrev(text));
23 |
24 | return (0);
25 | }
26 |
27 | int ft_putchar(char c)
28 | {
29 | write(1, &c, 1);
30 | return 0;
31 | }
32 |
33 |
34 | int ft_putnbr(int n)
35 | {
36 | if (n >= 10)
37 | {
38 | ft_putnbr(n / 10);
39 | ft_putnbr(n % 10);
40 | }
41 | else
42 | {
43 | ft_putchar(48 + n);
44 | }
45 | return 0;
46 | }
47 |
--------------------------------------------------------------------------------
/source/j05/ex16/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 23:01:30 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | //char *ft_strncat(char *dest, char *src, int nb);
16 | unsigned int ft_strlcpy(char *dest, char *src, unsigned int size);
17 |
18 | int main(void)
19 | {
20 | const char src1[10] = "ab121";
21 | char dest1[10] = "12123123";
22 |
23 | char src[10] = "ab121";
24 | char dest[10] = "12123123";
25 |
26 | size_t nb = 8;
27 | unsigned int nb2 = 8;
28 | //strcat(src, dest);
29 | printf("Str: %ld \n", strlcpy(dest1, src1, nb));
30 | printf("Str: %u", ft_strlcpy(dest, src, nb2));
31 | return (0);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j05/ex04/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/05 10:09:00 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/05 23:51:50 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int strncmp(const char *s1, const char *s2, size_t n);
16 | int ft_strncmp(char *s1, char *s2, unsigned int n);
17 |
18 | int main(void)
19 | {
20 | const char str1[] = "aaaacde";
21 | const char str2[] = "aaa";
22 |
23 | char str3[] = "aaaacde";
24 | char str4[] = "aaa";
25 | // unsigned int nb = 2;
26 |
27 | printf("Strncmo: %d ", strncmp(str1, str2, 0));
28 | printf("ft_strncmp: %d ", ft_strncmp(str3, str4, 0));
29 | // printf("src: %s ", str1);
30 | // printf("Search: %s ", str2);
31 | return (0);
32 | }
33 |
--------------------------------------------------------------------------------
/source/j05/ex07/ft_strcapitalize.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_strcapitalize.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 13:27:08 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/06 15:22:27 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 |
13 | char *ft_strcapitalize(char *str)
14 | {
15 | int i;
16 | int upper;
17 |
18 | i = 0;
19 | upper = 1;
20 | while (str[i] != '\0')
21 | {
22 | if ((str[i] >= '0' && str[i] <= '9') ||
23 | (str[i] >= 'a' && str[i] <= 'z') ||
24 | (str[i] >= 'A' && str[i] <= 'Z'))
25 | {
26 | if (upper && (str[i] >= 'a' && str[i] <= 'z'))
27 | str[i] = str[i] - 32;
28 | else if (!upper && (str[i] >= 'A' && str[i] <= 'Z'))
29 | str[i] = str[i] + 32;
30 | upper = 0;
31 | }
32 | else
33 | upper = 1;
34 | i++;
35 | }
36 | return (str);
37 | }
38 |
--------------------------------------------------------------------------------
/source/j08/ex04/ft_split_whitespaces.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int ft_nb_words(char *str)
4 | {
5 | int i;
6 | int sym;
7 | int count;
8 |
9 | i = 0;
10 | sym = 0;
11 | count = 0;
12 | if (!str)
13 | return (0);
14 | while (str[i])
15 | {
16 | while (str[i] != '\t' && str[i] != ' ' && str[i] != '\n' && str[i])
17 | {
18 | i++;
19 | sym = 1;
20 | }
21 | if (str[i] == '\t' || str[i] == ' ' || str[i] == '\n' || str[i] == '\0')
22 | {
23 | count += (sym == 1) ? 1 : 0;
24 | sym = 0;
25 | i++;
26 | }
27 | }
28 | return (count);
29 | }
30 |
31 | int ft_ln_w(char *str, int i)
32 | {
33 | int count;
34 |
35 | count = 0;
36 | while (str[i] != '\t' && str[i] != ' ' && str[i] != '\n' && str[i])
37 | {
38 | count++;
39 | i++;
40 | }
41 | return (count);
42 | }
43 |
44 | char **ft_split_whitespaces(char *str)
45 | {
46 | char **res;
47 | int i;
48 | int j;
49 | int k;
50 |
51 | i = 0;
52 | j = 0;
53 | if ((res = malloc(sizeof(char*) * (ft_nb_words(str) + 1))) == NULL)
54 | return (NULL);
55 | while (str[i])
56 | {
57 | while ((str[i] == '\t' || str[i] == ' ' || str[i] == '\n') && str[i])
58 | i++;
59 | if (str[i])
60 | {
61 | k = 0;
62 | if ((res[j] = malloc(sizeof(char) * ft_ln_w(str, i) + 1)) == NULL)
63 | return (NULL);
64 | while (str[i] != '\t' && str[i] != ' ' && str[i] != '\n' && str[i])
65 | res[j][k++] = str[i++];
66 | res[j++][k] = '\0';
67 | }
68 | }
69 | res[j] = NULL;
70 | return (res);
71 | }
--------------------------------------------------------------------------------
/source/j03/prog_ft_ultimate_div.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 12:21:34 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_putint(int a);
16 | int ft_putchar(char c);
17 | void ft_ultimate_div_mod(int *a, int *b);
18 |
19 | int main()
20 | {
21 |
22 | int *a;
23 | int *b;
24 |
25 | int ta;
26 | int tb;
27 |
28 | a = &ta;
29 | b = &tb;
30 |
31 | *a = 200;
32 | *b = 30;
33 |
34 | ft_ultimate_div_mod(a, b);
35 | printf("%d ", *a);
36 | printf("%d ", *b);
37 | return (0);
38 | }
39 |
40 | /*
41 | void ft_ultimate_div_mod(int *a, int *b)
42 | {
43 | int tmp_a;
44 | int tmp_b;
45 |
46 | tmp_a = *a;
47 | tmp_b = *b;
48 | *a = tmp_a / tmp_b;
49 | *b = tmp_a % tmp_b;
50 | }
51 | */
52 |
--------------------------------------------------------------------------------
/source/j03/ex03/prog_ft_ultimate_div.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 11:25:09 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_putint(int a);
16 | int ft_putchar(char c);
17 | void ft_ultimate_div_mod(int *a, int *b);
18 |
19 | int main()
20 | {
21 |
22 | int *a;
23 | int *b;
24 |
25 | int ta;
26 | int tb;
27 |
28 | a = &ta;
29 | b = &tb;
30 |
31 | *a = 21;
32 | *b = 4;
33 |
34 | ft_ultimate_div_mod(a, b);
35 | printf("%d ", *a);
36 | printf("%d ", *b);
37 | return (0);
38 | }
39 |
40 | /*
41 | void ft_ultimate_div_mod(int *a, int *b)
42 | {
43 | int tmp_a;
44 | int tmp_b;
45 |
46 | tmp_a = *a;
47 | tmp_b = *b;
48 | *a = tmp_a / tmp_b;
49 | *b = tmp_a % tmp_b;
50 | }
51 | */
52 |
--------------------------------------------------------------------------------
/source/j03/ex01/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 22:23:50 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | int ft_putint(int a);
16 | int ft_putchar(char c);
17 | void ft_ultimate_ft(int *********nbr);
18 |
19 | int main()
20 | {
21 | int a;
22 | int *ptr1;
23 | int **ptr2;
24 | int ***ptr3;
25 | int ****ptr4;
26 | int *****ptr5;
27 | int ******ptr6;
28 | int *******ptr7;
29 | int ********ptr8;
30 | int *********ptr9;
31 |
32 | a = 10;
33 | ptr1 = &a;
34 | ptr2 = &ptr1;
35 | ptr3 = &ptr2;
36 | ptr4 = &ptr3;
37 | ptr5 = &ptr4;
38 | ptr6 = &ptr5;
39 | ptr7 = &ptr6;
40 | ptr8 = &ptr7;
41 | ptr9 = &ptr8;
42 |
43 | printf("%d", a);
44 | ft_ultimate_ft(ptr9);
45 | printf(" %d ", a);
46 | return (0);
47 | }
48 |
--------------------------------------------------------------------------------
/source/j03/ex07/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/02 09:26:59 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/04 14:16:27 by ybarbier ### ########.fr */
10 | /* */
11 | /* **************************************************************************i */
12 | #include
13 |
14 | int ft_putchar(char c);
15 | int ft_putnbr(int n);
16 | char *ft_strrev(char * str);
17 |
18 | int main(void)
19 | {
20 | char text_str[] = "super";
21 |
22 | int counter;
23 | counter = 0;
24 | while (ft_strrev(&text_str[0])[counter] != '\0')
25 | {
26 | //ft_putnbr(counter);
27 | ft_putchar(ft_strrev(&text_str[0])[counter]);
28 | counter++;
29 | }
30 |
31 | return (0);
32 | }
33 |
34 | int ft_putchar(char c)
35 | {
36 | write(1, &c, 1);
37 | return 0;
38 | }
39 |
40 |
41 | int ft_putnbr(int n)
42 | {
43 | if (n >= 10)
44 | {
45 | ft_putnbr(n / 10);
46 | ft_putnbr(n % 10);
47 | }
48 | else
49 | {
50 | ft_putchar(48 + n);
51 | }
52 | return 0;
53 | }
54 |
--------------------------------------------------------------------------------
/source/j07/ex04/ft_split_whitespaces.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_split_whitespaces.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 16:04:09 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/08 23:36:13 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | char **ft_split_whitespaces(char *str)
15 | {
16 | char **str_split;
17 | char **str_tmp;
18 | int len;
19 | int i;
20 | int count_word;
21 |
22 | count_word = 0;
23 | len = 0;
24 | i = 0;
25 | while (str)
26 | {
27 | if (str[len] != 9 || str[len] != 32 || str[len] != '\n')
28 | count_word++;
29 | len++;
30 | }
31 | *str_split = (char*)malloc(sizeof(char) * (len + 1));
32 | len = 0;
33 | while (len < count_word)
34 | {
35 | i = 0;
36 | while (str[i] != 9 || str[i] != 32 || str[i] != '\n' || str[i] != '\0')
37 | {
38 | str_tmp[i] = str[i];
39 | i++;
40 | }
41 | str_split[len] = str_tmp;
42 | len++;
43 | }
44 | return (str_split);
45 | }
46 |
--------------------------------------------------------------------------------
/source/j02/ex04/ft_print_comb.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_print_comb.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 20:39:09 by ybarbier #+# #+# */
9 | /* Updated: 2014/07/31 20:39:40 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_print_comb(void)
13 | {
14 | int a;
15 | int b;
16 | int c;
17 |
18 | a = 0;
19 | b = 0;
20 | c = 0;
21 | while (a <= 9)
22 | {
23 | b = a + 1;
24 | while (b <= 9)
25 | {
26 | c = b + 1;
27 | while(c <= 9)
28 | {
29 | ft_putchar(48 + a);
30 | ft_putchar(48 + b);
31 | ft_putchar(48 + c);
32 | if (!(a == 7 && b == 8 && c == 9))
33 | {
34 | ft_putchar(',');
35 | ft_putchar(' ');
36 | }
37 | c++;
38 | }
39 | b++;
40 | }
41 | a++;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/source/j07/ex03/ft_concat_params.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_concat_params.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/08 13:49:24 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/08 15:56:56 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | char *ft_strcat(char *dest, char *src)
15 | {
16 | int i;
17 | int j;
18 |
19 | i = 0;
20 | while (dest[i] != '\0')
21 | i++;
22 | j = 0;
23 | while (src[j] != '\0')
24 | {
25 | dest[i + j] = src[j];
26 | j++;
27 | }
28 | dest[i + j] = '\n';
29 | dest[i + j + 1] = '\0';
30 | return (dest);
31 | }
32 |
33 | char *ft_concat_params(int argc, char **argv)
34 | {
35 | char *str;
36 | int i;
37 | int j;
38 | int count;
39 |
40 | count = 0;
41 | while (count < argc)
42 | {
43 | j = 0;
44 | while (argv[j])
45 | {
46 | count++;
47 | j++;
48 | }
49 | }
50 | str = (char*)malloc(sizeof(*str) * (count + 1));
51 | i = 0;
52 | while (i < argc - 1)
53 | {
54 | str = ft_strcat(str, argv[i + 1]);
55 | i++;
56 | }
57 | return (str);
58 | }
59 |
--------------------------------------------------------------------------------
/source/j08/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/06 11:12:06 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 01:39:57 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include "ft.h"
14 |
15 | #define TEXT "42 Born2Code !"
16 | #define TEST(x) int x;
17 | #define TEST2(x) #x;
18 | #define TEST3(x) TEST2(x) TEST2(x)
19 |
20 | #define TEST4
21 |
22 | #ifdef TEST4
23 |
24 | typedef char* char_p
25 |
26 | struct s_point
27 | {
28 | int x;
29 | int y;
30 | }
31 |
32 | enum e_list
33 | {
34 | val1,
35 | val2 = 5,
36 | val3 // Vaudra 6
37 | };
38 |
39 | int main(void)
40 | {
41 | struct s_point a;
42 | struct s_point b;
43 | a.y = 12;
44 | a.x = 42;
45 | b = a;
46 | ptr = &a;
47 | // (*ptr).x;
48 | ptr->x;
49 |
50 | enum e_list a;
51 |
52 | a = val1;
53 |
54 | char_p str = TEXT;
55 | TEST(a)
56 | TEST(b)
57 | TEST2(42 school)
58 | TEST3(OK Great)
59 | ft_putstr(str);
60 | printf(" %d \n", ft_strlen(str));
61 |
62 | return (0);
63 | }
64 | #endif
65 |
--------------------------------------------------------------------------------
/source/j06/ex04/ft_sort_params.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_sort_params.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 01:50:35 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/07 16:41:05 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ft_putchar(char c);
13 |
14 | void ft_putstr(char *str)
15 | {
16 | int i;
17 |
18 | i = 0;
19 | while (str[i] != '\0')
20 | {
21 | ft_putchar(str[i]);
22 | i++;
23 | }
24 | }
25 |
26 | int ft_strcmp(char *s1, char *s2)
27 | {
28 | int i;
29 |
30 | i = 0;
31 | while ((s1[i] == s2[i]) && (s1[i] != '\0' && s2[i] != '\0'))
32 | i++;
33 | return (s1[i] - s2[i]);
34 | }
35 |
36 | int main(int argc, char **argv)
37 | {
38 | char *tmp;
39 | int find;
40 | int i;
41 |
42 | find = 1;
43 | while (find)
44 | {
45 | find = 0;
46 | i = 0;
47 | while (++i < argc - 1)
48 | {
49 | if (ft_strcmp(argv[i], argv[i + 1]) > 0)
50 | {
51 | tmp = argv[i];
52 | argv[i] = argv[i + 1];
53 | argv[i + 1] = tmp;
54 | find = 1;
55 | }
56 | }
57 | }
58 | i = 0;
59 | while (++i < argc)
60 | ft_putstr(argv[i]), ft_putchar('\n');
61 | return (0);
62 | }
63 |
--------------------------------------------------------------------------------
/source/j08/ex04/ft_param_to_tab.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* ft_param_to_tab.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/09 12:58:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/11 23:58:39 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include "ft_stock_par.h"
13 |
14 | char *ft_strdup(char *src)
15 | {
16 | int i;
17 | int len;
18 | char *str;
19 |
20 | len = 0;
21 | while (src[len])
22 | len++;
23 | str = (char*)malloc(sizeof(*str) * (len + 1));
24 | i = 0;
25 | while (i < len)
26 | {
27 | str[i] = src[i];
28 | i++;
29 | }
30 | return (str);
31 | }
32 |
33 | struct s_stock_par *ft_param_to_tab(int ac, char **av)
34 | {
35 | t_stock_par *stock;
36 | int i;
37 | int j;
38 |
39 | stock = (t_stock_par*)malloc(sizeof(t_stock_par) * (ac + 1));
40 | if (!stock)
41 | return (NULL);
42 | i = 0;
43 | while (i < ac)
44 | {
45 | j = 0;
46 | while (av[i][j])
47 | j++;
48 | stock[i].size_param = j;
49 | stock[i].str = av[i];
50 | stock[i].copy = ft_strdup(av[i]);
51 | stock[i].tab = ft_split_whitespaces(av[i]);
52 | i++;
53 | }
54 | stock[i].str = 0;
55 | return (stock);
56 | }
57 |
--------------------------------------------------------------------------------
/source/j07/main.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* main.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/07 16:59:04 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/09 22:56:25 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | //#include
14 |
15 | char *ft_strdup(char *src);
16 | int *ft_range(int min, int max);
17 | int ft_ultimate_range(int **range, int min, int max);
18 | char *ft_concat_params(int argc, char **argv);
19 | char **ft_split_whitespaces(char *str);
20 |
21 | int main(int argc, char **argv)
22 | {
23 | // char *str;
24 | // char *str2;
25 | // int *tab;
26 | // int *tab_ulti;
27 | // int i;
28 |
29 | /* //Ex00
30 | str = "42 school";
31 | str2 = ft_strdup(str);
32 |
33 | printf("%s", str);
34 | printf("%s", str2);
35 | */
36 | /*
37 | //Ex01
38 | tab = ft_range(10, 20);
39 |
40 | i = 0;
41 | while (i < 10)
42 | {
43 | printf("%d ", tab[i]);
44 | i++;
45 | }
46 | */
47 | /*
48 | //Ex02
49 | int i = ft_ultimate_range(&tab_ulti,10, 30);
50 | int j = 0;
51 |
52 | printf("Nb %d - ", i);
53 | while (j < 30)
54 | {
55 | printf("%d ", tab_ulti[j]);
56 | j++;
57 | }
58 | */
59 | //Ex03
60 | printf("%s", ft_concat_params(argc, argv));
61 |
62 |
63 | return (0);
64 | }
65 |
--------------------------------------------------------------------------------
/source/j03/test2.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/01 12:21:34 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 |
14 | int ft_putint(int a);
15 | int ft_putchar(char c);
16 | void ft_div_mod(int *a, int *b);
17 |
18 | int main()
19 | {
20 | /*
21 | int a;
22 | int *ptr;
23 | int **ptr2;
24 |
25 | a = 50;
26 | ptr = &a;
27 | ptr2 = &ptr;
28 |
29 | printf("%d", **ptr2);
30 | **ptr2 = 42;
31 | ft_ft(&ptr2);
32 | printf(" %d", a);
33 | */
34 | /*
35 | int a;
36 | int b;
37 | int *div;
38 | int *mod;
39 | int tdiv;
40 | int tmod;
41 |
42 | a = 20;
43 | b = 5;
44 | tdiv = 0;
45 | div = &tdiv;
46 | mod = &tmod;
47 |
48 | ft_div_mod(a, b, &tdiv, &tmod);
49 | printf("%d ", *div);
50 | printf("%d", *mod);
51 | */
52 |
53 | int a;
54 | int b;
55 | int *div;
56 | int *mod;
57 | int tdiv;
58 | int tmod;
59 |
60 | a = 20;
61 | b = 5;
62 |
63 |
64 | ft_div_mod(a, b, div);
65 | printf("%d ", *div);
66 | printf("%d", *mod);
67 |
68 | /*
69 | int *a;
70 | int *b;
71 | int *div;
72 |
73 | *a = 20;
74 | *b = 5;
75 |
76 | ft_div_mod(a, b, div);
77 | printf("%d ", *div);
78 | printf("%d", a);
79 | */
80 | return (0);
81 | }
82 |
83 |
84 | void ft_div_mod(int *a, int *b, int *div)
85 | {
86 | *div = *a / *b;
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/source/j02/prog.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* prog.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/07/31 14:04:32 by ybarbier #+# #+# */
9 | /* Updated: 2014/07/31 18:27:19 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | #include
13 | #include
14 |
15 | void ft_print_alphabet(void);
16 | int ft_putchar(char c);
17 | void ft_print_reverse_alphabet(void);
18 | void ft_print_numbers(void);
19 | void ft_is_negative(int n);
20 | void ft_print_comb(void);
21 |
22 | int main()
23 | {
24 | ft_print_alphabet();
25 | return (0);
26 | }
27 |
28 |
29 | void ft_print_reverse_alphabet(void)
30 | {
31 | int i;
32 | i = 'z';
33 | while (i >= 'a') {
34 | ft_putchar(i);
35 | i--;
36 | }
37 | }
38 |
39 | int ft_putchar(char c)
40 | {
41 | write(1, &c, 1);
42 | return (0);
43 | }
44 |
45 | void ft_print_numbers(void)
46 | {
47 | int i;
48 | i = 48;
49 | while (i <= 57)
50 | {
51 | ft_putchar(i);
52 | i++;
53 | }
54 | }
55 |
56 | void ft_is_negative(int n)
57 | {
58 | if (n < 0)
59 | {
60 | ft_putchar('N');
61 | }
62 | else
63 | {
64 | ft_putchar('P');
65 | }
66 | }
67 |
68 | void ft_print_comb(void)
69 | {
70 | int a;
71 | int b;
72 | int c;
73 |
74 | a = 0;
75 | b = 0;
76 | c = 0;
77 | while (a <= 9)
78 | {
79 | b = a + 1;
80 | while (b <= 9)
81 | {
82 | c = b + 1;
83 | while (c <= 9)
84 | {
85 | ft_putchar(48 + a), ft_putchar(48 + b), ft_putchar(48 + c);
86 | if (!(a == 7 && b == 8 && c == 9))
87 | ft_putchar(','), ft_putchar(' ');
88 | c++;
89 | }
90 | b++;
91 | }
92 | a++;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/source/mini-projet00/sastantua.c:
--------------------------------------------------------------------------------
1 | /* ************************************************************************** */
2 | /* */
3 | /* ::: :::::::: */
4 | /* sastantua.c :+: :+: :+: */
5 | /* +:+ +:+ +:+ */
6 | /* By: ybarbier +#+ +:+ +#+ */
7 | /* +#+#+#+#+#+ +#+ */
8 | /* Created: 2014/08/03 14:19:47 by ybarbier #+# #+# */
9 | /* Updated: 2014/08/03 21:38:02 by ybarbier ### ########.fr */
10 | /* */
11 | /* ************************************************************************** */
12 | void ligne1(int size);
13 | int ft_putchar(char c);
14 | void size_space(int size, int space);
15 | void ligne_repeat_etage(int etage);
16 | void create_etage(int nb_ligne, int *nb_space_start, int *nb_etoile_start);
17 |
18 | void sastantua(int size)
19 | {
20 | ligne1(size);
21 | }
22 |
23 | void ligne1(int size)
24 | {
25 | int j;
26 | int start_ligne;
27 | int start_etoile;
28 | int start_space;
29 |
30 | j = 0;
31 | start_etoile = 1;
32 | start_ligne = 3;
33 | start_space = (size * (size + 1) + 2 * size);
34 | while (j < size)
35 | {
36 | start_space = start_space - 2;
37 | create_etage(start_ligne, &start_space, &start_etoile);
38 | start_ligne++;
39 | start_etoile = start_etoile + 4;
40 | j++;
41 | }
42 | }
43 |
44 | void ligne_repeat_etage(int etage)
45 | {
46 | int i;
47 | int j;
48 | int size;
49 |
50 | i = 0;
51 | j = 3 + etage - 1;
52 | size = 1;
53 | while (i < 3 + etage)
54 | {
55 | size_space(size, j);
56 | size += 2;
57 | i++;
58 | j--;
59 | }
60 | }
61 |
62 | void create_etage(int nb_ligne, int *nb_space_start, int *nb_etoile_start)
63 | {
64 | int i;
65 |
66 | i = 0;
67 | while (i < nb_ligne)
68 | {
69 | size_space(*nb_etoile_start, *nb_space_start);
70 | *nb_space_start = *nb_space_start - 1;
71 | *nb_etoile_start += 2;
72 | i++;
73 | }
74 | }
75 |
76 | void size_space(int size, int space)
77 | {
78 | int i;
79 | int j;
80 |
81 | i = 0;
82 | j = 0;
83 | while (j < space)
84 | {
85 | ft_putchar(' ');
86 | j++;
87 | }
88 | ft_putchar('/');
89 | while (i < size)
90 | {
91 | ft_putchar('*');
92 | i++;
93 | }
94 | ft_putchar('\\');
95 | ft_putchar('\n');
96 | }
97 |
--------------------------------------------------------------------------------
/source/j00/ex02/exo2.tar:
--------------------------------------------------------------------------------
1 | test0/ 000715 023710 010167 00000000000 12342672444 012352 5 ustar 00ybarbier 2014 000000 000000 test1 000714 023710 010167 00000000004 12342701370 012261 0 ustar 00ybarbier 2014 000000 000000 aaa
2 | test2/ 000504 023710 010167 00000000000 12342710314 012335 5 ustar 00ybarbier 2014 000000 000000 test3 000404 023710 010167 00000000001 12342717240 012257 0 ustar 00ybarbier 2014 000000 000000
3 | test4 000641 023710 010167 00000000002 12342717144 012267 0 ustar 00ybarbier 2014 000000 000000 a
4 | test5 000404 023710 010167 00000000000 12342717240 013244 1test3 ustar 00ybarbier 2014 000000 000000 test6 000755 023710 010167 00000000000 12342705360 013254 2test0 ustar 00ybarbier 2014 000000 000000
--------------------------------------------------------------------------------