Hi Folks,
I've got a problem with the code below:
The problem is, that the last for-loop crashes on writting to the array after X loops.Code:char** map; int iRows = 40; int iColumns = 50; //map = (char**)GlobalAlloc(GMEM_FIXED, iRows+1); map = (char**)new char[iRows]; for(int i=0;i<iRows;i++) //map[i] = (char*)GlobalAlloc(GMEM_FIXED, iColumns+1); map[i] = (char*)new char(iColumns); for(int i=0;i<iRows;i++){ for(int j=0;j<iColumns;j++){ map[i][j] = 'X'; } }
There is no problem in allocation, globalalloc and new both work fine it seems.
what is wrong in that code?




Reply With Quote