Original Post
Umm, hey there people, iv been working on a small program of no significance, and im trying to use dynamically allocated arrays. The tutorial iv been working on is a bit dodgy (no offense to the author meant), and I cant get his method to work. Anyway, heres the details on my problem, the snippet and the errors: ********************************THE SOURCE*************************** *****************************THE ERRORS************************************ Im trying to create an array of characters, incase thats not obvious. Any help is appreciated, thanks.
char ***MapDATA;
*MapDATA = malloc(sizeof(int**) * LayerDepth);
for(int LayersProcessed = 0; LayersProcessed < LayerDepth; ++LayersProcessed)
{
MapDATA[LayersProcessed] = malloc(sizeof(int*) * MapSizeInTilesX);
for(int x = 0; x < MapSizeInTilesX; ++x)
{
MapDATA[LayersProcessed][x] = malloc(sizeof(int) * MapSizeInTilesY);
}
};
};
Compiling...
Maps.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\GoodCopy\Maps.cpp(101) : error C2440: '=' : cannot convert from 'void *' to 'char ** '
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\Program Files\Microsoft Visual Studio\MyProjects\GoodCopy\Maps.cpp(106) : error C2440: '=' : cannot convert from 'void *' to 'char ** '
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\Program Files\Microsoft Visual Studio\MyProjects\GoodCopy\Maps.cpp(111) : error C2440: '=' : cannot convert from 'void *' to 'char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Error executing cl.exe.
GoodCopy.exe - 3 error(s), 0 warning(s)