Hi!
when I try to run this code:
struct Cand{
// 0 -> not a cand
// 0.5 -> preCand
// 1 -> cand
float status;
// Row position
int PosX;
// Col position
int PosY;
/*
*
and many other things
*
*/
};
int rows = 1024;
int cols = 1024;
int main(int argc, char** argv)
{
// allocate memory for possible cand
Cand* ptrCand = (Cand*)malloc(sizeof(Cand)*rows*cols);
ptrCand[16*1024+16].status = 0.5; /* exception happens here*/
}
I getthis exception:
Unhandled exception at 0x00e358e3 in t.exe: 0xC0000005: Access violation writing location 0x02028080.
any help why this happens?