oh sorry, the compiler just reads "running" the way it had before when i had
Code:
int numFibs= 20;
int fibonacci[numFibs];
Does it make sense to separate the two? So the fibonacci is it's own function?
kind of like this, except not because that still doesn't work
Code:
#include <stdio.h>
int arraySum(int *array, const int n)
{
int sum = 0;
int * const arrayEnd = array + n;
for ( ; array < arrayEnd; ++array )
sum +=*array;
return sum;
}
int fibonacci(int *fib)
{
int i;
fib[20];
fib [0] = 0;
fib [1] = 1;
for(i = 2; i < 20; ++i)
fib[i] = fib[i-2] + fib[i-1];
return 0;
}
int main(void)
{
int arraySum (int *array, const int n);
int fibonacci(int *fib);
int fib[20];
printf("Their sum is %i\n ", arraySum (fib, 20) );
return 0;
}