skeletton untested project
This commit is contained in:
commit
6fc620e8f4
187 changed files with 6584 additions and 0 deletions
33
libft/ft_putnbr_fd.c
Executable file
33
libft/ft_putnbr_fd.c
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 17:44:20 by thrieg #+# #+# */
|
||||
/* Updated: 2025/02/16 19:04:23 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
static unsigned int ft_abs(int a)
|
||||
{
|
||||
if (a < 0)
|
||||
return (-a);
|
||||
return (a);
|
||||
}
|
||||
|
||||
void ft_putnbr_fd(int n, int fd)
|
||||
{
|
||||
if (n < 0)
|
||||
ft_putchar_fd('-', fd);
|
||||
if (ft_abs(n) < 10)
|
||||
ft_putchar_fd(ft_abs(n) + '0', fd);
|
||||
else
|
||||
{
|
||||
ft_putnbr_fd(ft_abs(n / 10), fd);
|
||||
ft_putnbr_fd(ft_abs(n % 10), fd);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue