Im sorry to bother anyone.
I just started programming in C,and got a K&R to guide me.
The thing is.I made code that counts spaces, tabs and new lines.
Now the problem is,once i build and run everything,when i try to type something,it doesen't actually count anything.
Im just looking for some help.It would be really great if you could explain this to me.Sorry about this,i didn't have time to attach the actual file.
Here is the code:
Code:
#include <stdio.h>
main()
{
int c, fl, fn, fb;
fl = 0;
fn = 0;
fb = 0;
while ((c = getchar()) != EOF) {
if (c == ' ')
++fl;
if (c == '\t')
++fn;
if (c == '\n')
++fb;
}
printf ("d %d %d\n", fl, fn, fb);
}