Question: 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

```

?

Answer: 
Since you are returning a pointer to an array, the return type should be `int*`. Here is sample code:

```
int* fibonacci(int ceiling) //Modified return type
{
  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); //Return the address of the array's starting position
}

```
You want to return one element from `fibArray`, correct? In that case, use `return fibArray[...];`, where `...` is the element index.