从键盘输入一行字符,利用指针统计其中的大小写字母个数。要求子函数
根据有关信息 推测出:choice(str)在主函数直接使用了 上面choice函数没返回值 下面主函数没接收值
望采纳!!
程序都有error,哪会出答案
n还没输入大小,能定义数组么
#include <stdio.h>
#include <ctype.h>
#define N 256
int count_letters(const char *s)
{
int n = 0;
while (*s)
if (isalpha(*s++))
n++;
return n;
}
int main()
{
char a[N];
fgets(a, N, stdin);
printf("%d", count_letters(a));
return 0;
}
char str[n]出错了,括号内不能使用变量