A is a 2d array and data is 1d array
double **A, *data;
fullsize is 9222, memory allocation:
A = (double **)malloc((fullsize)*sizeof(double *)); //allocate memory dynamically for matrix A
for (i = 0; i < fullsize; i++)
A[i] = (double *)malloc((2 * fullsize)*sizeof(double));
data = (double *)malloc((fullsize*fullsize)*sizeof(double *));
conversion logic:
{
for (int n = 0; n<fullsize; n++)
for (int m = 0; m<fullsize; m++)
{
data[n*fullsize + m] = A[n][m];
}
}
error log:
The thread 0xad80 has exited with code 0 (0x0).
Unhandled exception at 0x00F5E6E9 in ConsoleApplication1.exe: 0xC0000005: Access violation writing location 0x69E65000.
The program '[50964] ConsoleApplication1.exe' has exited with code 0 (0x0).