fjdksl546   4년 전

예시를 넣었을 때의 과정을 종이에 적어가면서 코드의 논리대로 풀어나가면 올바르게 나오는데 컴퓨터로 하면 이상한 답이 나와요.

어디서 틀린건지 좀 가르쳐주세요..ㅠㅠ

seico75   4년 전

42라인과 같이 읽으면 \n 도 읽힙니다. 

그래서 " %c" 와 같이 하면 whitespace 는 제외되고 읽힙니다.



  • whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling isspace in a loop). Note that there is no difference between "\n", " ", "\t\t", or other whitespace in the format string.

https://en.cppreference.com/w/cpp/io/c/fscanf

fjdksl546   4년 전

아하,,감사합니다!!

댓글을 작성하려면 로그인해야 합니다.