首页 > 代码库 > P95

P95

#include<stdio.h>
void fun(char *s,int *t)
{
	int i,n=0;
	for(i=0;s[i]!=0;i++)
		if(s[i]>='0'&&s[i]<='9')
			n++;
		*t=n;
}
main()
{
	char s[80]="asdf45edx7sd7";
	int t;
	printf("\nThe original string is :%s\n",s);
	fun(s,&t);
	printf("\nThe result is :%d\n",t);
}

P95