My professor has asked us to write a program that uses recursion to solve a fibonacci sequence. This is all pretty normal, but he's asked us to make our function return void. I've been working at this for a few days now and can't find a way to do this.
I have:
void fibonacci(double *n,double *x,double *y,double *result) {
if(*n == 1)
*result = 0;
else if(*n == 2)
*result = 1;
else
fibonacci(--n,n,(n-1),(n+(n-1))); }
Is what I'm doing right? I have never had to use parameters in such ways before and I'm not sure if I'm on the right track. For some reason it's not compiling at the recursive call to fibonacci, stating invalid pointer addition. Thanks!