Question:Write a C-program that asks for text input from the keyboard. The output of this program gives the amount of characters, the amount of words and the amount of newlines that has been typed. Reading keys from the keyboard is possible by using the function getchar(). The reading of characters from the keyboard can be stopped when the shutdown-code ^D (CTRL + D) is entered.
^D has the ASCII-value 4. Use a while loop.
And my code is as following:
void main ()
{
int charLength = 0;
int wordCount = 0;
int newlineCount = 1;
char c=getchar();