char **ft_split(char const *s, char c);
설명
먼저 특정 문자를 기준으로 문자열을 자르는 방법입니다
인자
s 분할 할 문자열입니다.
c구분 문자
리턴값
분할 결과 새 문자열의 배열입니다. 할당이 실패하면 NULL입니다.
get_num 함수는 들어온 문자열이 구분 문자를 기준으로 몇개로 나눠질지 갯수를 세는 함수 이다.

ft_strcpy는 문자열 복사 함수다.

메모리 해제 함수다

do_split는 2차원배열로 동적할당한 str 배열에 인덱싱을 매겨서 또 동적할당을 한다.
그리고 ft_strcpy함수를 호출해서 복사한다.

char **ft_split(char const *s, char c)
str 동적 실패 시 리턴 0
s 가 null 리턴 0
n 이 0이면 리턴 str

'42 Libft' 카테고리의 다른 글
# 1.21 ft_strtrim (0) | 2020.10.14 |
---|---|
# 1.20 ft_strmapi (1) | 2020.10.14 |
#1.18 ft_strdup (0) | 2020.10.10 |
#1.17 ft_calloc 틀림 수정해야함 (0) | 2020.10.10 |
#1.16 ft_strjoin (0) | 2020.10.08 |