here is my function,max is global;
#include<iostream>
using namespace std;
int max = 0;
int q = 0;
int func(int a[], int n)
{
int k = 1;
for(int j = q + 1; j < n; j++)
{
if(a[j] <= a[j - 1])
{
if(k >= max)
{
max = k;
q = j;
}
return 0;
}
k++;
}
if(k > max)
{
max = k;
return 1;
}
}
Here it gives the error that it's ambiguous to compare k with max. Is it because of max being global?