Hi, this is probably a very novice question but I can't figure out why this isn't working and searching the web and this forum hasn't helped either.
I have this:
It counts the occurrences of new lines. However, printf() is never run after the while loop has terminated. Why is this?Code:#include <stdio.h> main() { int c, nl; nl = 0; while((c = getchar()) != EOF) { if (c == '\n') ++nl; } printf("%d\n",nl); }