As far as I can tell, it does work. That is, the program should compile without errors and when it runs its behavior should be fully defined.
Maybe you and the computer simply have different definitions of "to work". What's the output you're expecting?
Unfortunately, this line: printnum ( begin++); calls the function with exactly the same parameter. That means each call is identical and the recursion never terminates.
The postincrement operator begin++ does not add one to 'begin' until after the function call.
I suspect what you really want is the pre-increment version, ++begin, like this: