This was given as an example of recursivity. It prints 123456789987654321.
Now, I can see this code printing 1234567899, but whence does it count back down? I don't see where the code goes back and counts down.Code:#include <stdio.h> void printnum ( int begin ) { printf( "%d", begin ); if ( begin < 9 ) /* The base case is when begin is no longer */ { /* less than 9 */ printnum ( begin + 1 ); } /* display begin again after we've already printed everything from 1 to 9 * and from 9 to begin + 1 */ printf( "%d", begin ); } int main() { printnum(1); }
And, I know this has nothing to do with that, but it's easier than two threads. Is it possible to write a program that will open another progam? Such as, a program that will accept integers to select from a menu of programs, like notepad = 1, and then run that program's executable, and close itself?