I've been working on a project using my, now, old PC using visual C++.
everything works fine there.
Now i'm attempting to run it on my new imac. however an strange error occurs.
after allocating a simple 2d array
when the following loop is processed
EXC_BAD_ACCESS occurs. I made some research and i found something like there are holes in the memory or i should use a convention to a 1-dimensional array to deal with it. Another suggestions were around C++ object programing.
it should work on simple C, but i don't know what is happening and i have plans to stay with macos =]
everything works fine there.
Now i'm attempting to run it on my new imac. however an strange error occurs.
after allocating a simple 2d array
Code:
a = (int**) malloc(sizeof(int)*10);
for(i=0;i<10;i++){a[i] = (int*) malloc(sizeof(int)*10);}
when the following loop is processed
Code:
for(i=0;i<10;i++){for(j=0;j<10;j++){a[i][j]=0;}}
EXC_BAD_ACCESS occurs. I made some research and i found something like there are holes in the memory or i should use a convention to a 1-dimensional array to deal with it. Another suggestions were around C++ object programing.
it should work on simple C, but i don't know what is happening and i have plans to stay with macos =]