Hi all,
I encounter a 'Access violation writing location 0x00e1d2e4' when executing my code. It worked fine when the size was smaller. The following is the code. Any help will be appreicated!!
I encounter a 'Access violation writing location 0x00e1d2e4' when executing my code. It worked fine when the size was smaller. The following is the code. Any help will be appreicated!!
Code:
int *distance = (int*)malloc(sizeof(int)*size);
memset(distance,0,size*sizeof(int));
int *trace = (int*)malloc(sizeof(int)*size);
memset(trace,0,size*sizeof(int));
for(i=0;i<targetSize;i++){
*(distance+i)=0;
*(trace+i)=STOP;
}
for(i=1;i<querySize;i++){
*(distance+i*querySize)=0;
//The program breaks here.
*(trace+i*querySize)=STOP;
}
Comment