I have seen several posts in regards to the Character Counting section but none of them answers the question to not displaying the output correctly even after using Ctrl+D to exit.
#include <stdio.h>
int main() {
long nc;
nc = 0;
while (getchar() != EOF) {
++nc;
}
printf("%ld\n", nc);
}
It doesn't count the characters just exit. What am I doing incorrectly? This is done in CLion on Mac