From 7099cc732e899fbd869e22ea05af2987d0b6e01c Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Fri, 5 Nov 2021 21:01:14 -0400 Subject: [PATCH] Example of a cleaner IO implementation --- 04-file-copying.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/04-file-copying.c b/04-file-copying.c index 5c7e6f2..a5e7e92 100644 --- a/04-file-copying.c +++ b/04-file-copying.c @@ -1,13 +1,10 @@ #include -/* copy input to output; 1st version */ +/* copy input to output; 2nd version */ int main() { int c; - c = getchar(); - while (c != EOF) { + while ((c = getchar()) != EOF) putchar(c); - c = getchar(); - } }