Copy stdin to stdout: Difference between revisions

Content added Content deleted
(→‎C: Made the code portable. The function "getchar" returns an int; storing its result in a char variable can mean the loop comparison is never true if a char is unsigned on your platform. Also, I modified the formatting slightly.)
Tags: Mobile edit Mobile web edit
Line 111:
#include <stdio.h>
 
int main() {
charint c;
while ( (c = getchar()) != EOF ) {
putchar(c);
}