how would you reverse a number , using recursion, in C
(i.e. 1234 becomes 4321)
how would you reverse a number , using recursion, in C
(i.e. 1234 becomes 4321)
foo ( x / 10 );
printf( "%d", x % 10 );
Just a clarification to Salem's post, if you want to print the number in reverse, print num % 10 first, and then recurse.
printf ( "%d", x % 10 );
recurse ( x / 10 );
-Prelude
My best code is written with the delete key.