Hi all,
I am developing a program where I generate tree-like generations and store resulting offspring for each generation in a 3D structure. As generation level increases the number of individuals gets higher and I end up with very large tables. At one point I get the following allocation error:
Unhandled exception at 0x004157e6 in offspring.exe: 0xC0000005: Access violation writing location 0x00000000.
I am allocating memory in a loop using calloc:
and the program stops at this line:
and I really don't see what the problem can be.
Could anyone help me???
Many thanks in advance
Julie
I am developing a program where I generate tree-like generations and store resulting offspring for each generation in a 3D structure. As generation level increases the number of individuals gets higher and I end up with very large tables. At one point I get the following allocation error:
Unhandled exception at 0x004157e6 in offspring.exe: 0xC0000005: Access violation writing location 0x00000000.
I am allocating memory in a loop using calloc:
Code:
/* Allocate the full memory for the information */
// nucleotides[gen][seq][nuc] is the 3D table
nucleotides[gen] = (int **)calloc(n_seq[gen], sizeof(int *));
for (seq = 0; seq < n_seq[gen]; seq++)
{
nucleotides[gen][seq] = (int *)calloc(n_nuc, sizeof(int));
}
and the program stops at this line:
Code:
nucleotides[gen][seq][nuc] = nucleotides[x][y][nuc];
and I really don't see what the problem can be.
Could anyone help me???
Many thanks in advance
Julie