ft_strjoin.c 1.1 KB

123456789101112131415161718192021222324
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strjoin.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2014/11/10 17:27:47 by mazimi #+# #+# */
  9. /* Updated: 2015/06/25 16:03:01 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. char *ft_strjoin(char const *s1, char const *s2)
  14. {
  15. char *str;
  16. if (s1 == NULL || s2 == NULL)
  17. return (NULL);
  18. str = ft_strnew(ft_strlen(s1) + ft_strlen(s2));
  19. ft_strcpy(str, s1);
  20. return (ft_strcat(str, s2));
  21. }