Array initialization error

1

I'm not understanding this error in the array.

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define MAX 800

int main () {
     float ponto[MAX][MAX];
     float i, j, n, y, x, aux_st, aux_s;
     y = x = aux_st = aux_s = 0.0;
     n = MAX;

     for (i = 0; i < n; i++ ) {
           x =  - 2 + (i/n);
           for (j = 0; j < n; j++) {
                y = 2 - (j/n);
                aux_s = pow(x, 2) + pow(y, 2) - 1;
                aux_st = pow(aux_s, 3) - pow(x, 2)*pow(y, 3);
                if (aux_st == 0) ponto[i][j] = 246;
              }
      }
return 0;
}

Here is the result, containing the error:

prog.c: In function 'main':
prog.c:18:39: error: array subscript is not an integer
                 if (aux_st == 0) ponto[i][j] = 246;
                                       ^
prog.c:7:12: warning: variable 'ponto' set but not used [-Wunused-but-set-variable]
      float ponto[MAX][MAX];
    
asked by anonymous 21.09.2016 / 16:09

1 answer

4

The error message is very clear: array indexes must be integers. You're using float! This is wrong.

    
21.09.2016 / 16:16