I cannot really know what could be your problem, but due to my experience after allocation by malloc/sys_malloc/nx_alloc it is necessary immediately to fill variables with values (memset), and set pointers (at least to NULL). Only when this is done, you can assign individual values e.g. myarray[3] = 123; , as frankjiang suggested.
moreover I always use it like:
mystructarray = (*mystruct)sys_malloc( myarraylength * sizeof(mystruct) );
where myarraylength must be int
malloc is needed when you need realloc only. sys_malloc is more stupid safe, and features auto memory freeing on engine close.


Free world editor for 3D Gamestudio: MapBuilder Editor