push
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/02/22 23:03:38 by sgongas #+# #+# */
|
||||
/* Updated: 2026/02/22 23:12:01 by sgongas ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putchar(char c)
|
||||
{
|
||||
write(1, &c, 1);
|
||||
}
|
||||
|
||||
void ft_putnbr(int nb)
|
||||
{
|
||||
if (nb == -2147483648)
|
||||
{
|
||||
write(1, "-2147483648", 11);
|
||||
return ;
|
||||
}
|
||||
if (nb < 0)
|
||||
{
|
||||
ft_putchar('-');
|
||||
nb = -nb;
|
||||
}
|
||||
if (nb > 9)
|
||||
ft_putnbr(nb / 10);
|
||||
ft_putchar(nb % 10 + '0');
|
||||
}
|
||||
|
||||
// int main(void)
|
||||
// {
|
||||
// ft_putnbr(21474);
|
||||
// return (0);
|
||||
// }
|
||||
Reference in New Issue
Block a user