I'm writing some code using the getchar function. The program should get the input character by character (using getchar) and ending when a new line character 'n' is reached or the EOF character is reached. Here's the code I worked out:
I know it's sloppy, but I'm a newbie so please bear with me. How can I fix this up so that I can read characters until a new line character 'n' is reached?
printf("Please enter as many characters as you would like. Press enter or send
the EOF character when you are done.\n");
while( (c=getchar()) != EOF)