#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); }
时间: 2024-11-05 16:01:47