It seems that you want to copy the memory from e.g. gridReal
to grid
. First of all, you have to remember that a pointer to pointer to some type is not the same as an array or arrays of the same type. The memory layout is simply not compatible. Secondly, you can't simply assign an array to a pointer like that, and expect the data to be copied.
Instead you allocate the outer "dimension" first, then in a loop allocate (and copy) the second "dimension":
char **grid = malloc(50));
for (int i = 0; i < 50; ++i)
{
grid[i] = malloc(sizeof(gridReal[0]);
memcpy(grid[i], gridReal[i], sizeof(gridReal[i]));
}