Segment violation (was Re: Why I could not cast string to int?)

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 2 14:54:10 PST 2012


On Thu, Feb 02, 2012 at 02:47:22PM -0800, H. S. Teoh wrote:
[...]
> 	int fib(int n) {
> 		if (n <= 2) return 1;
> 		else return fib(n-2) + fib(n+1);
[...]

Ugh. That should be fib(n-1), not fib(n+1). But no matter, such a thing
shouldn't ever be actually written and compiled, as Andrei says. :)


T

-- 
Change is inevitable, except from a vending machine.


More information about the Digitalmars-d-learn mailing list