I have this struct:
struct table{
int miny,maxy,maxa;
int** list;
};
and its subsequent typedef:
typedef struct table *StatTable;
So, my doubt is the following:
On the initialisation of a struct table I do this and it might work fine:
StatTable newStatistic(int min,int max,int maxauts){
StatTable aux=malloc(sizeof(StatTable));
aux->miny=min;
aux->maxy=max;
aux->maxa=maxauts;
aux->list=calloc(((max-min))*(maxauts+1),sizeof(int));
return aux;
}
Since I declared that list as an int ** can I implement a function this way?
int get(StatTable st,int ano,int nAut){
return st->list[ano-getMinYear(st)][nAut];
}
listrange. i.e there is no item atlist[x][y], you should validate the index before using[].