ft_puttabint.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_puttabint.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2015/02/18 20:54:35 by mazimi #+# #+# */
  9. /* Updated: 2015/12/11 12:15:06 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. void ft_puttabint(int **tab, int len, int spaces)
  14. {
  15. int i;
  16. int j;
  17. int limit;
  18. int sp;
  19. i = -1;
  20. while (tab[++i] != NULL)
  21. {
  22. j = (len == 0) ? 0 : -1;
  23. limit = (len == 0) ? tab[i][0] - 1 : len;
  24. while (++j < limit)
  25. {
  26. sp = -1;
  27. ft_putnbr(tab[i][j]);
  28. while (++sp < spaces)
  29. ft_putchar(' ');
  30. }
  31. ft_putchar('\n');
  32. }
  33. }