Convertir un nombre d'une base vers une autre base en C

#include <stdio .h="">
long convertirEnBase10 (long n, int base)
{
long quotient = n / 10;
long reste = n % 10;
if (quotient == 0)
return reste;
else
return convertirEnBase10 (quotient, base) * base + reste;
}
long convertirEnBase2 (long n, int base)
{
long quotient = n / 2;
long reste = n % 2;
if (quotient == 0)
return reste;
else
return convertirEnBase2 (quotient, base) * base + reste;
}

long convertirEnBase4 (long n, int base)
{
long quotient = n / 4;
long reste = n % 4;
if (quotient == 0)
return reste;
else
return convertirEnBase4 (quotient, base) * base + reste;
}

long convertirEnBase8 (long n, int base)
{
long quotient = n / 8;
long reste = n % 8;
if (quotient == 0)
return reste;
else
return convertirEnBase8 (quotient, base) * base + reste;
}

long convertirEnBase16 (long n, int base)
{
long quotient = n / 16;
long reste = n % 16;
if (quotient == 0)
return reste;
else
return convertirEnBase16 (quotient, base) * base + reste;
}

int main () {
long n = 17;
int base = 10;
//Décimal --> base(2,4,8,16)
printf ("%ld en base %2d = %ld en base 2\n",n, base, convertirEnBase2 (n, base) );
printf ("%ld en base %2d = %ld en base 4\n",n, base, convertirEnBase4 (n, base) );
printf ("%ld en base %2d = %ld en base 8\n",n, base, convertirEnBase8 (n, base) );
printf ("%ld en base %2d = %ld en base 16\n",n, base, convertirEnBase16 (n, base) );

//Binaire --> Décimal
n = 1010;
base = 2;
printf ("%ld en base %2d = %ld en base 10\n",n, base, convertirEnBase10 (n, base) );

//Héxadécimal --> Décimal
n = 124;
base = 16;
printf ("%ld en base %2d = %ld en base 10\n",n, base, convertirEnBase10 (n, base) );

//base 8 --> binaire
n = 12;
base = 8;
printf ("%ld en base %2d = %ld en base 10\n",n, base, convertirEnBase10 (n, base) );

return 0;
}