If you want output aswell, add putchar(c) command into you while loop. Also, you'll need a variable for that.
Code:
int c;
while((c = getchar()) != EOF)
{
putchar(c);
nc++;
}
EOF is declared in stdio.h to signal an end of file. I has an value of -1, since normal ascii characters have values 0-255 (extended set).
This also answers a question why shouldnt you store characters from input to a character type variable - because of EOF. A char variable can contain values -128 till 127(not 255), thats why int is used.