2007-11-21から1日間の記事一覧

1-7

コレは簡単。 #include <stdio.h> /* * EOF の値を印字するプログラム **/ main(){ printf("%d",EOF); } [ERROR:1]% ./1-7 -1%</stdio.h>

1-6

難しい。。。。 #include <stdio.h> /* * getchar() != EOF が0か1しかないことを確認 **/ main(){ int c; c = 1; while(c){ c = (getchar() != EOF); printf("%d",c); } } [ERROR:1]% echo '1234' | ./1-6 111110% 5回1がでてるのは末尾に\nがついているから?全</stdio.h>…