열렬히.뛰기

ft_split

école 42 > exam02 > exam02 : part4 > ft_split

문제

c
Assignment name  : ft_split
Expected files   : ft_split.c
Allowed functions: malloc
--------------------------------------------------------------------------------

Write a function that takes a string, splits it into words, and returns them as
a NULL-terminated array of strings.

A "word" is defined as a part of a string delimited either by spaces/tabs/new
lines, or by the start/end of the string.

Your function must be declared as follows:

char    **ft_split(char *str);

구현 팁

  • 어디서 걸리는지 생각하기
  • 다 만들고, ./a.out | cat -e 까지 꼭 걸어보기
  • 에러 처리까지 할 필요가 있는지는 잘 모르겠음.

주의점

  1. 이차원 배열 마지막에 꼭 0 넣어주기
  2. 일차원 배열 (문자열) 마지막에 꼭 ‘\0’ 넣어주기