I am having problems with a pair of corecursive functions I am trying to write. One function should sum the alphabetic characters in a string and the other function should sum the total of the digits in the same string. They should call each other. What I have so far is below, but I'm not sure how to fix the errors or what I am missing? Any and all help would be greatly appreciated.
Code:
void count_alph(char *ctest_string,int *alph_sum, int *digit_sum)
{
int i=0;
static int alpha_count;
*alph_sum= alpha_count;
while (ctest_string[i]!='\0')
if (isalpha(ctest_string[i++]))
++alpha_count;
else
sum_digit(ctest_string, digit_sum, alph_sum);
}
void sum_digit(char *stest_string, int *digit_sum, int *alph_sum)
{
int j=0;
static int sum_count;
*digit_sum=sum_count;
while (stest_string != '\0')
if(isdigit(stest_string[j++]))
sum_count += stest_string[j];
else
count_alph(stest_string,digit_sum,alph_sum);
}