When ever I try to access my matrix which is Line***
I get a seg fault.
A simple operation such as (matrix[i][j]->vbit == 00),{int vbit}
gives me a segmentation fault. I am assuming it is within the constructor, but I can't seem to find the issue. Anyone see it?
Line ***getSets(int width, int height){
int i;
int j;
Line *temp;
Line line;
printf("Make %d sets with %d lines\n",height,width);
Line*** matrix = (Line***)calloc(height,sizeof(Line**));
for(i=0;i < height;i++){
matrix[i] = (Line**)calloc(width,sizeof(Line*));
}
/// Set all vbits to 0
for(i = 0; i < height;i++){
for(j = 0;j <width; j++){
temp = matrix[i][j];
temp = malloc(sizeof(Line));
temp->vbit = 0;
temp->tag = 0;
temp->lastUsed = 0;
}
}
return matrix;}