Can someone point out where I went wrong?
Code:
// Fiboncacci Test---------------------------------
int n;
int* fib;
printf("\nFibonacci test 1: enter an integer\n");
scanf("%d",&n);
fib = a(n);
printf("fib(%d) = ", n);
for(int i = 0; i < n; ++i)
{
printf("%d ", fib[i]);
}
Code:
int a(const int c)
{
int i;
int b[c];
for(i = 2; i<c; ++i)
{
b[0] = 0;
b[1] = 1;
b[i] = b[i-1] + bi-2];
}
return b[i];
}
I have no idea where I went wrong, I have check through my course book and still I am stuck, any help appreciated! Thank you.