What you did is called recursion. And the number of times a function can call itself is depended on the number of parameters to the function and the stack size of the program. Every time a function is called, whether recursive or not, the program has to save the values of important registers on the stack so that they can be restored when program control is returned back to the function, and it has to also save the value of all parameters on the stack (there are a few times when that is not done, but I'll ignore them now). So a function with no parameters can be called recursively more times than a function that has one or more parameters. The more parameters the fewer times it can be called.