본문 바로가기

42Seoul/libft36

ft_putchar_fd putchar_fd? //원 함수 없음 void ft_putchar_fd(char c, int fd); 구현해야할 함수 기능 : Outputs the character ’c’ to the given file descriptor. 해석 및 부연설명 : 주어진 file descriptor에 문자 'c'를 출력한다. ex) ft_putchar_fd('a', 1); 코드 실행 결과 a 지정한 file descriptor(1)에 정상적으로 문자 'a'가 출력되었다. 의문점 및 생각해볼점 file descriptor? 표준 입출력? file descriptor란 기본 개념 링크 파일 오픈 또는 소켓(물리적으로 연결된 네트워크상에서의 데이터 송수신에 사용할 수 있는 소프트웨어적인 장치)을 생성하여 시스템에 할당 시 .. 2023. 2. 16.
ft_lstnew lstnew? typedef struct s_list { void*content; struct s_list*next; }t_list; //원 함수 없음 t_list *ft_lstnew(void *content); 구현해야할 함수 기능 : Allocates (with malloc(3)) and returns a new element. The variable ’content’ is initialized with the value of the parameter ’content’. The variable ’next’ is initialized to NULL. 해석 및 부연설명 : 새로운 리스트 원소를 생성하여 할당하여 반환한다. 이 때 원소의 변수 content는 인자로 받아온 매개변수로 초기화되어야하고, 변수.. 2023. 2. 16.
ft_strmapi strmapi? //원 함수 없음 char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); 구현해야할 함수 기능 : Applies the function ’f’ to each character of the string ’s’ , and passing its index as first argument to create a new string (with malloc(3)) resulting from successive applications of ’f’. 해석 및 부연설명 : 문자열 s의 각 문자에 함수 f가 적용된(해당 문자의 인덱스를 함수 f의 첫번째 인자로 사용) 새로운 문자열을 생성하여 반환한다. 할당 실패시엔 NULL을 반환한다. ex) ch.. 2023. 2. 16.
ft_striteri striteri? //원 함수 없음 void ft_striteri(char *s, void (*f)(unsigned int, char*)); 구현해야할 함수 기능 : Applies the function f to each character of the string passed as argument, and passing its index as first argument. Each character is passed by address to f to be modified if necessary. 해석 및 부연설명 : 문자열 s의 각 문자에 함수 f를 적용시킨다. strmapi 함수와는 달리 새 문자열을 생성하지 않고, 대신 함수 포인터의 두번째 매개변수로 각 문자의 주소값을 사용하여 기존 문자열에 저장되어.. 2023. 2. 16.