#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putnbr(int nb)
{
if (nb == -2147483648) // 가장 작은 int 값을 처리
{
write(1, "-2147483648", 11);
return;
}
if (nb < 0)
{
ft_putchar('-');
nb = -nb;
}
if (nb >= 10)
{
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else
ft_putchar(nb + '0');
}
int main(void)
{
ft_putnbr(2147483647); // 예시: 21 출력
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: