From 9bde00749e9944c357267a024b3ec78d81a6799c Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 2 Jul 2019 23:44:43 +0200 Subject: c00 start, shell01 ex01 correcion --- c00/ex04/ft_is_negative.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 c00/ex04/ft_is_negative.c (limited to 'c00/ex04') diff --git a/c00/ex04/ft_is_negative.c b/c00/ex04/ft_is_negative.c new file mode 100644 index 0000000..58c1b60 --- /dev/null +++ b/c00/ex04/ft_is_negative.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_is_negative.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/02 22:43:22 by cacharle #+# #+# */ +/* Updated: 2019/07/02 22:50:01 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +void ft_is_negative(int n); + +void ft_is_negative(int n) +{ + char negative_char; + char positive_char; + + negative_char = 'N'; + positive_char = 'P'; + if (n < 0) + write(1, &negative_char, 1); + else + write(1, &positive_char, 1); +} + +int main(void) +{ + ft_is_negative(-1); + ft_is_negative(1); + ft_is_negative(0); + return (0); +} -- cgit