diff options
Diffstat (limited to 'ch1/copier.c')
-rw-r--r-- | ch1/copier.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ch1/copier.c b/ch1/copier.c new file mode 100644 index 0000000..eeade8e --- /dev/null +++ b/ch1/copier.c @@ -0,0 +1,29 @@ +#include <stdio.h> + +/* Copy input to output; 1st version */ +//main() { +// int c; +// +// c = getchar(); +// +// while (c != EOF) { +// putchar(c); +// c = getchar(); +// } +//} + +/* Copy input to output; 2nd version */ +main() { + int c; + + while ((c = getchar()) != EOF) { + putchar(c); + } +} + +//main() { +// printf("%d", EOF); +// getchar(); +// printf("%d", getchar()); +// printf("%d", getchar()); +//} |