Acquaintance pointer string of statistics letter

Description Questions
enter a string. The method requires the use of pointers to traverse the string, and counting the number of strings in the English alphabet.
Enter
Enter a string, no more than 999 characters, ending with a carriage return.
Output
number of the output string of letters.
Input Example
How are you!
Output example
9
data range
input character string, the output is an integer. And the input string no more than 999 characters

#include "stdio.h"
void main()
{
char s[999],*p;
int i=0,flag=1;
gets(s);
for(p=s;*p!='\0';*p++)
{
if(*p>='a'&&*p<='z'||*p>='A'&&*p<='Z')
i++;
}

printf("%d",i);


}

Guess you like

Origin blog.csdn.net/Lhw_666/article/details/91415200