Fibonacci using memoization

I was trying to implement Fibonacci but I am getting unexpected values.What am I doing wrong ?

//Fibonacci
#include <iostream>
using namespace std;

int calfib(int n,int memo[]);

int fib(int n)
{
	int i,memo[n];
	for(int i = 0 ; i < n ;i++)
	{
		memo[i] = -1;
	}
	memo[0] = 0;
	memo[1] = 1;

	return calfib(n,memo);
}

int calfib(int n, int memo[])
{
	if(memo[n] != -1)
		return memo[n];

	else
	{
		return (calfib(n-2,memo) + calfib(n-1,memo));	
	}
}

int main()
{	
	cout << fib(8) << endl;
}

It is because you are storing -1 into memo[0] to memo[n-1], not upto memo[n]. Correcting it will get correct answer.
BTW, why are you using this recursive solution when we can have better solutions?
(According to me, iterative solution makes more intuitive sense.)
You might be unaware that this solution has time complexity O(n), which can be further reduced to O(logN).
http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/