ft_print_params.c 429 B

1234567891011121314151617181920212223242526272829303132
  1. /* We’re dealing with a program here, you should therefore have a function main in
  2. your .c file.
  3. Create a program that displays its given arguments */
  4. #include <unistd.h>
  5. void ft_putchar(char c)
  6. {
  7. write(1, &c, 1);
  8. }
  9. int main(int argc, char **argv)
  10. {
  11. int i, j;
  12. char n;
  13. i = 1;
  14. j = 0;
  15. n = '\n';
  16. if (argc > 1)
  17. {
  18. while (argv[i][j])
  19. {
  20. ft_putchar(argv[i][j]);
  21. j++;
  22. }
  23. ft_putchar(n);
  24. i++;
  25. }
  26. return (0);
  27. }