As an exercise I had to write a recursive function that computes the greater common denominator between two numbers. Before the use of a few brain cells that made me write one good answer:

I wrote the same function as follows:Code:int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); }

Although the program worked correctly I can't understand one thing.Code:int gcd(int a, int b) { int temp; if (b != 0) { temp = b; b = a % b; a = temp; gcd(a, b); } else return a; }

What happens to the functions that are expected to return a value (int) but they won't return any?

They do not seem to wrap up aftergcd(a, b=0)returns the correct result to the program.

Thank you for your time to read my post !!!