array type has element type incomplete

0

I am not able to compile my program, the compiler is accusing "array type has element type incomplete" in function that prints points.

The function that prints dot:

 float imprimePonto(struct armazenar p[], int n)
{
    int i;
    for(i=0;i<n;i++)
    {
        printf("(%9.2f, %9.2f)\n",p[i].x,p[i].y);
    }
    return 0;
}

a struct:

struct armazenar
{
    float x;
    float y;
};

main:

#define MAX 10
    int main()
    {
        struct armazenar p[MAX];
        int n=0;

        n=func_lerN();//recebendo o numero de vetores que o usuario quer digitar.

        func_lerVetor(n);
        imprimePonto(p[MAX],n);


        return 0;
    }
    
asked by anonymous 07.12.2016 / 12:26

1 answer

0

In the line imprimePonto(p[MAX],n); should be passed the vector itself as it is in the signature of the function float imprimePonto(struct armazenar p[], int n) , ie you should replace imprimePonto(p[MAX],n); with imprimePonto(p,n); .

The% w of% is a position of the vector, in this case invalid, if you want to pass the vector itself you must indicate the vector% w_ of% and not a position of it.     

13.12.2016 / 14:20