ft_strncat.c 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strncat.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2015/11/23 16:30:39 by bchanot #+# #+# */
  9. /* Updated: 2018/10/29 11:57:23 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. char *ft_strncat(char *s1, const char *const s2, size_t n)
  14. {
  15. size_t i;
  16. size_t j;
  17. i = ft_strlen(s1);
  18. j = 0;
  19. while (j < n && s2[j])
  20. {
  21. s1[i] = s2[j];
  22. i++;
  23. j++;
  24. }
  25. s1[i] = '\0';
  26. return (s1);
  27. }