When I compile the c file, gcc returns no errors, but a segmentation fault occurs at runtime. The debugger showed that the fault occurs in this part of the code:
int q=size[current];
int *temp;
temp = malloc ( sizeof(int)*q);
for(i=0;i<size[current];i++)
temp[i]=arr[current][i];
arr is defined :
int arr[20][200];
current by default is 0.
I am trying to copy the contents of an array inside the 2d array (arr) to a temporary array, I've tried not using malloc but still the same problem.
ps: the program runs fine on windows.