I'm writing a code that's supposed to get input for the the size of a 2D array, location of an area inside the array, and the contents of the array. It doesn't do anything with those at this point, but when I tried to compile this code, it gives me errors about pointers. I've never used pointers before, and this code's no exception.
I've actually solved the problem by making the variable names numberless, but I'm really curious why this error occurs.
#include <bits/stdc++.h>
using namespace std;
int n, m, a, b;
int x0, x1, y0, y1;
int main()
{
// freopen("seri3.gir","r",stdin);
// freopen("seri3.cik","w",stdout);
cin >> n >> m;
cin >> x0 >> x1 >> y0 >> y1;
x0--, x1--, y0--, y1--;
int f[n][m],g[n][m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
cin >> f[i][j];
if ((j > y0 || j < y1) && (i > x0 || i < x1)) {
g[j][i] = f[j][i];
f[j][i] = 0;
cout << g[j][i] << endl;
}
}
}
This is one of the longest error messages I've ever gotten. It's a compiler error, basically telling that I can't compare pointers and integers and that it couldn't convert doubles over and over again. Note that I haven't used any pointers or doubles in the code. Here's the full error (The compiler is g++, and the IDE is Geany)