Programming 530

C언어의 feof() 함수 사용에 대해

me.tistory.com :: C언어의 feof() 함수 사용에 대해 C언어의 feof() 함수 사용에 대해 Studies 카테고리는 제가 공부하다가 기록하는 용도로 씁니다. 혹시 여기에 기록된 것이 잘못되었다면, 댓글로 꼭 알려주세요. feof, file - end of file 이라고 해서 파일의 끝에 도달하면 멈춘다고 생 me.tistory.com 많은 프로그래머들이 C의 feof() 함수를 Pascal의 eof()처럼 사용하지만, C의 feof()는 파스칼의 그것과 같은 방식으로 작동하지 않습니다. 차이점이 뭘까요? 파스칼의 eof는 '다음'에 읽어오는 부분이 파일의 끝이라 실패하는 경우에 true를 리턴합니다. 반면 C의 feof는 '마지막' 함수가 실패하는 경우에 true를 리턴합니다.

Programming 2023.10.05

c - Why (and when) do I need to use parentheses after sizeof? - Stack Overflow

c - Why (and when) do I need to use parentheses after sizeof? - Stack Overflow Why (and when) do I need to use parentheses after sizeof? The below fails to compile: typedef int arr[10]; int main(void) { return sizeof arr; } sizeof.c:3: error: expected expression before ‘arr’ but if I change it to sizeof(arr); everything is ... stackoverflow.com According to 6.5.3, there are two forms for sizeof ..

Programming 2023.10.04

F#과 Haskell의 type inference 비교

F#의 type inference는 Haskell을 쓸 때보다 주의할 점이 있다. 예제로, 수 목록을 구간 목록으로 변환하는 프로그램을 작성해보았다. F#에서는 이렇게 리스트에 대해 .[0]을 사용하면 타입 선언 없이는 컴파일되지 않는다: let addToIntervals (intervals: (int * int) list) (n: int) = if not intervals.IsEmpty && n = (fst intervals.[0]) - 1 then (n, (snd intervals.[0])) :: (List.tail intervals) else (n, n) :: intervals let toIntervals (nums: int list) = List.fold addToIntervals [] (List..

Programming 2023.09.21