有关指针变量作为函数参数的
函数的调用可以得到一个返回值,而使用指针变量作为参数,可以得到多个变化的值。求大神求解啊??
#include <stdio.h> void count_w(char* source,int* sum_num,int* sum_char,int* sum_space) { while(*source!='\0') { if(*source>='a' && *source<='z') (*sum_char)++; if(*source>='A' && *source<='Z') (*sum_char)++; if(*source>='0' && *source<='9') (*sum_num)++; if(*source==0x20) (*sum_space)++; source++; } } int main(void) { int sum_num=0,sum_char=0,sum_space=0; char* dest="122314dslkjfaKSLDJ 23sdfa"; count_w(dest,&sum_num,&sum_char,&sum_space); printf("sum of num is %d\n",sum_num); printf("sum of char is %d\n",sum_char); printf("sum of space is %d\n",sum_space); return 0; }