diff options
author | Adam Carpenter <gitlab@53hor.net> | 2019-07-09 16:00:48 -0400 |
---|---|---|
committer | Adam Carpenter <gitlab@53hor.net> | 2019-07-09 16:00:48 -0400 |
commit | 39c0cbcc70aff47e17107826aa76cb525c83b122 (patch) | |
tree | df483af220a11aab49e0e3a76eea54f60efbd424 /ch1/copier.c | |
parent | 583fc81152e120ec5873f8057f11a894bb8b0a91 (diff) | |
download | learning-c-39c0cbcc70aff47e17107826aa76cb525c83b122.tar.xz learning-c-39c0cbcc70aff47e17107826aa76cb525c83b122.zip |
ch2
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()); +//} |