#include <stdio.h> void fun(char *s, int *t) { int i, n; n=0; for(i=0; s[i] !=0; i++) if(s[i]>='0'&&s[i]<= '9') n++; *t=n ; } main() { char s[80]="abcdef35adgh3kjsdf7"; int t; printf("\nThe original string is : %s\n",s); fun(s,&t); printf("\nThe result is : %d\n",t); }
原文地址:http://blog.csdn.net/u013116579/article/details/38712375