在main函数中调用is_empty函数的时候,编译器给我不明确的错误提示,我想知道为什么
#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int head = 0;
int tail = 0;
const int MAX = 10;
int a[MAX];
bool is_empty();
int pop();
void push(int c);
int main()
{
push(1);
push(2);
while (!is_empty())
{
cout << pop();
}
return 0;
}
void push(int c)
{
tail = tail % MAX;
a[tail] = c;
tail++;
}
bool is_empty()
{
if (head == tail)
return true;
else
return false;
}
int pop()
{
int tem = a[head++];
head = head % MAX;
return tem;
}