I'm developing c++ application . I have allocated memory but im getting the Error Thread 1: EXC_BAD_ACCESS ( code=2,address=0x8)
in superfile.cpp. Here is my code :
superfile.h
struct Node{
Voxel *data;
Node *next;
};
superfile.cpp
int* cnt =(int*)calloc(_width*_height,sizeof(int));
Voxel *temp =(Voxel *)calloc(_width*_height,sizeof(Voxel));
Node *list=(Node *)calloc(_width*_height*2,sizeof(Node));
list[(_width*_height)+l].next = list[_width*yy + xx].next->next; // Thread 1: EXC_BAD_ACCESS ( code=2,address=0x8) Error c++
after debugging the values of the variables are:
_width=60
_height=45
l=3
yy=4096
xx=-3345
Any idea what is going on ? Thank you