I'm reading through the K&R book and implemented the 'copy' example:
#include <stdio.h>
int main() {
    char c;
    while ((c = getchar()) != EOF) {
        putchar(c);
    }
    return 0;
}
All normal input appears to work correctly but when an EOF (^D) is entered the program prints infinite "�" characters and I must halt the program manually.
I have tried using putchar(c); as well as printf("%c", c); to the same effect.
Does anyone know the cause of this?
 
     
    