apue 에 있는 예제에 관한 질문입니다.
글쓴이: supaflow / 작성시간: 수, 2006/09/13 - 8:56오후
#include "ourhdr.h" int main(void) { int c; while ( (c = getc(stdin)) != EOF) if (putc(c, stdout) == EOF) err_sys("output error"); if (ferror(stdin)) err_sys("input error"); exit(0); }
apue에 있는 예제파일 입니다.
문자를 입력하면 그대로 반환하는 프로그램인데요.
저기서 왜 c 의 타입이 char 형이 아닌 정수(int) 형인지 궁금하네요.
char 로 해도 동작은 제대로 되던데 말이죠..
Forums:
man getc int getc(FILE
man getc
int getc(FILE *stream);
댓글 달기