Code:
scanf("%s",filename);
Bad. Read my signature for more information.
Code:
pfile = fopen(strcat(filename,".txt\0"),"r");
Confusing to the end user. You say enter a filename but automatically append .txt, even with no mention of so. You don't even check if there even IS a .txt extension in the inputted filename either.
fgetc returns int, but a is char. This causes a warning. I suggest you redeclare all those variables to int instead.
Code:
if(a==' '||(a>32&&a<48)||(a>57&&a<65)||a=='\n')
{
words++;
if(b==' '||b<65||(b>90&&b<97)||b>122)
words--;
}
What's this mess? How am I supposed to know what ASCII value 32 is? Use string liters, such as '\n', ' ', etc, like you've done a little already.
Code:
while(ch1!=EOF)
{
count = '.';
count++;
}
What's this supposed to do? It does nothing, except an infinite loop!
Code:
while(y!=EOF)
{
x = '\n';
x++;
}
Same here... infinite loop.
Code:
while(n!=EOF)
{
z = '?';
z++;
}
Same here... infinite loop.
Perhaps you should try to actually fix your code first.