/* ** my_putnbr with signed int */ static int my_putnbr(int nbr) { if (nbr < 10 && nbr >= 0) return (my_putchar_c(nbr + '0')); else if (nbr < 0 && nbr * -1 < 10) { my_putchar_c('-'); return (1 + my_putchar_c(nbr * -1 + '0')); } else { return (my_putnbr(nbr / 10) + my_putchar_c(nbr < 0 ? (nbr * -1) % 10 + '0' : nbr % 10 + '0')); } }
int my_printf(char *str, ...) { va_list ap; int index; index = 0; va_start(ap, str); while (str[index] != '\0') { if (str[index] == '%') if_mod(&index, str, &ap); else { my_putchar_c(str[index]); } index++; } va_end(ap); return (number_carac); }