Logo

Programming-Idioms

History of Idiom 31 > diff from v6 to v7

Edit summary for version 7 by :

Version 6

2015-08-19, 17:21:52

Version 7

2015-08-20, 10:33:38

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Code
unsigned int f(unsigned int i)
{
	return i?i*f(i-1):1;
}