- #include <algorithm>
- using namespace std;
- int count = 0,cache[50];
- int f(int n)
- {
- if(n == 2) count++;
- if(n == 0 || n==1) return n;
- else if (cache[n] !=- 1) return cache[n];
- else cache[n]= f(n-1) + f(n-2);
- return cache[n];
- }
- prog.cpp: In function ‘int f(int)’:
- prog.cpp:38: error: reference to ‘count’ is ambiguous
在我的本地机器上(mingw32),我得到的错误是this one,虽然不是int’cache []’.
有什么原因吗