1

I have a problem with defining 2d arrays for structs . when I define a big array like a[1000][1000] it gives me stack overflow error.

typedef struct {
int prtcls[10000], numb;

  } intpos;
  int main() {
  intpos* mypos[1000][1000];
 }

I am trying to make a 1000 * 1000 of grids which each grid can have particles inside (maximum 10000) and also i need number of particles inside each grid. In other way i want to get id of my particles in each id and also how many particles are in it . something like this for example :

mypos[1][1].numb = i ;
for(int j = 0 ; j < i;j++)
{
   printf("%d",mypos[1][1].prtcls[j]);

}

0 Answers0