#include <stdio.h>
#include <stdlib.h>
int main()
{
char str[100];
gets(str);
char *ptr=str;
void fuction(char *);
fuction(ptr);
return 0;
}
void fuction(char *str1)
{
int i=0,a=0,b=0,c=0,d=0;
do
{
if(*(str1+i)>='A'&&*(str1+i)<='Z')
{
a+=1;
}
if(*(str1+i)>='a'&&*(str1+i)<='z')
{
b+=1;
}
if(*(str1+i)>='1'&&*(str1+i)<='9')
{
c+=1;
}
i++;
}while(*(str1+i-1)!='\0');
d=i-a-b-c-1;
printf("%d\n%d\n%d\n%d\n%d",a,b,c,d,i-1);
}
知识点总结:本程序应用了指针来传递函数值,这有可能会改变变量本身的值,应注意避免
学习心得:以后每写完一个程序就要跟上一段总结,否则隔得时间太长容易忘。
本文介绍了一个使用C语言编写的简单程序,该程序通过指针传递字符串,并统计其中的大写字母、小写字母、数字和其他字符的数量。此外,还提供了一些关于指针使用的注意事项。

4579

被折叠的 条评论
为什么被折叠?



