diff options
| author | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-02 23:44:43 +0200 |
|---|---|---|
| committer | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-02 23:44:43 +0200 |
| commit | f870cace58c695e417cde3c6f1ae9d3838d83bc3 (patch) | |
| tree | da718a1c479f0846d29326c63e925a35c1e9d4ee /c00/ex04 | |
| parent | 0619a89ac7c9fc5debc3f7c6d2ee348d2d00b58a (diff) | |
| download | piscine-f870cace58c695e417cde3c6f1ae9d3838d83bc3.tar.gz piscine-f870cace58c695e417cde3c6f1ae9d3838d83bc3.tar.bz2 piscine-f870cace58c695e417cde3c6f1ae9d3838d83bc3.zip | |
c00 start, shell01 ex01 correcion
Diffstat (limited to 'c00/ex04')
| -rw-r--r-- | c00/ex04/ft_is_negative.c | 36 |
1 files changed, 36 insertions, 0 deletions
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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/02 22:43:22 by cacharle #+# #+# */ +/* Updated: 2019/07/02 22:50:01 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +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); +} |
