[ad_1]
Variable c will always contain just 1 character, which is int. You are overwriting previous value with return value of a function getchar in each iteration of a loop.
Also try to avoid duplicate code by rewriting the while loop. You can call function getchar and assign value to variable c inside the while condition:
while ((c = getchar()) != EOF) {
putchar(c);
}
5
[ad_2]
solved getchar and putchar do not work like the name specifies [duplicate]