C examples: simple input to output

C programming language is one of the most used in the world. Actually by TIOBE index 2018 it is placed at the second stage of the most cited languages. In the series of posts C examples I will introduce different examples of C code.

Today I start with first example. It is simple program that accepts input from stdin and returns it to stdout.

/* Copy input to output */
#include 

int main(void)
{
  int c;

  while ((c=getchar()) != EOF)
    putchar(c);

  return 0;
}


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed