What am I doing wrong? CodeBlocks says about the error: invalid types 'int[int]' for array subscript , in the line with instructions cfl=c[v][i]-f[v][i];

 int n, k, d, lim, t, cmmin = 1000, answ, g[100][100], c[100][100], f[100][100], w[100], v, minFlow, v1, v2, s, i; bool visited[100]; vector<int> put; void where() { int f, cfl; vector<int> put; v = 0; while (!(v == n + d + 1)) { f = 0; visited[v] = true; put.push_back(v); for (int i = w[v]; i < n + d + 1; ++i) { cfl = c[v][i] - f[v][i]; if ((!visited[i]) && (cfl > 0)) { v = i; w[v] = i; minFlow = min(cfl, minFlow); f = 1; break; } if (f == 0) { put.pop_back(); v = put[put.size()]; } } } } 
  • you are variable int f,cfl; f closed array declaration f[100][100] rename something. - pavel
  • School code, I just learn and do not pretend to anything. - Spicy Сlutches
  • one
    @gbg is taught in schools. If you want to compensate for the shortcomings of school education - tell us how to do it right. - Nick Volynkin
  • @ SpicyСlutches in almost every development environment there is code auto-formatting. I highly recommend using it at all at work, and before publication on SO is a must. This is a manifestation of elementary respect for reading the question, because unformatted code is difficult to read. - Nick Volynkin
  • @ SpicyСlutches for single-line variables - really, a bad practice. In a good way, they would still be useful meaningful names. So it will be clearer and there will be no such absurd mistakes when accidentally re-using a letter. ) - Nick Volynkin

0