I'm writing a C program that calculates a specific number in the fibonacci sequence, though I'm having trouble returning the sequence as an array....
What am I doing wrong?
int fibonacci(int ceiling) { int counter; int num1 = 1, num2 = 1; static int fibArray[1000]; for (counter = 1; counter < ceiling; counter+=2) { fibArray[counter] = num1; fibArray[counter+1] = num2; num2 += num1; num1 += num2; } return &(fibArray); }
I also get the error:
fibonacci.c:28: warning: return makes integer from pointer without a cast
?