You are correct, that example is not really an example of tail recursion. For it to be true tail recursion it would have to call itself as the very last operation and do nothing else.
You can make it tail recursive by splitting it into two functions:
Code:
int factorial(int n){
return factorial(n, 1);
}
int factorial(int n, int counter){
if( n == 0 ){
return counter;
}
return factorial(n-1, n * counter);
}
(Well, technically you only need the second function -- the first is a convenience function.)