typedef struct {
double *x;
int points;
} Polygon;
polygon[cc].points = readobject(polygon[cc].file); //lets say equals 15
polygon[cc].x = (double *) malloc(polygon[cc].points * sizeof(double));
printf("%d\n", sizeof(polygon[cc].x) / sizeof(polygon[cc].x[0]));
//This prints out on 1
I've test initializing x
as x[100]
and it works then, but shouldn't the malloc()
call set the struct's array at x[15]
? Is it just measuring the bytes of two double
s?