42cursus/printf3 printf flowchart 프로토 타입 : int printf(char *format string, ...) 출력문자열의 길이를 return해주는 것을 계속 기억하고 있어야함. ex) printf("My age is %-3d years old\n", 32); -형식 문자열(format string): "My age is %-3d years old\n" -형식 태그(format tag): %-3d -variadic argument(가변인자) : ... 내 코드의 전체적인 구조는 아래 이미지와 같다. 1. 형식문자열에서 '%'를 기준으로 형식태그와 형식태그가 아닌 부분으로 나뉘어진다. (가변인자와 형식 문자열에 있는 *의 갯수는 일치한다고 가정한다.(=warning behavior)) 2. 형식문자열을 읽으면서, '%'을 기준으로 형.. 2020. 7. 25. printf_check-list 1. 서식문자열에서 서식태그와 가변인자로 넣어주는 개수가 일치하지 않을 때 (printf와 ft_printf 모두 동일하게 서식문자와 서식태그에 대응 값만 출력되고 나머지는 무시한다.) gcc -Wall -Wextra -Werror 에서 에러로 표현해주기때문에, 이러한 경우는 배제하기로한다. 2. 모든 정보는 결국 bit로 저장된다. -> signed unsigned도 값이 다르게 보여도 실제 bit값은 동일하다. 읽는 byte의 범위가 다르거나, 읽어서 해석하는 방법이 다를 뿐이다. int 는 ft_itoa로 해결가능하지만, unsigned int 는 다른 방법으로 해결해야한다. ->ft_utoa.c 새로 만듦 3. flag처리 정확도 s 넓이(width) cspdiuxX%(all) 넓이에 0채움 pd.. 2020. 7. 10. printf 자료조사 Variadic function Variadic function : function that takes a arbitrarily many argument. "The C function printf and the Common Lisp function format are two such examples. Both take one argument that specifies the formatting of the output, and any number of arguments that provide the values to be formatted."[1] Variadic functions can expose type-safety problems in some languages. high-severity secu.. 2020. 7. 6. 이전 1 다음