There are two main considerations in writing recursive functions. The first is that it calls itself. This implies that the function does a finite portion of the work at hand. For example, in this case, it may process 1 digit and return the [accumulated] sum. The other consideration is that there must be an ending condition. Without this, the function would call itself infinitely (or until it runs out of stack space). In this case, when it runs out of digits to process, it is done.
Consider a recursive function to compute the factorial of a number, n. (Untested, of course.)
1 2 3 4 5 6 7
int factorial( int n ) {
if( 1 == n ) {
return 1; // ending condition
}
return factorial( n - 1 ) * n; // calls itself
}