I'm trying to allocate memory to dynamically resize an array of a class. As in other parts the malloc()-call works well for me, I tried using realloc(). But this doesn't seem to work, it always returns me a NULL-pointer. So, what function can I use to resize an array dynamically? Here's the code in question:
Aion wrote:Not sure if it's realated, but the size allocated should be :
-sizeof(geo_object*) * geo_object_count
you're right, that would probably have been the next problem I'd run into :) My problem was, that I tried to access the **geo_objects-var using array-style instead using pointer-arithmetics (geo_object[0] instead geo_object+0). However, thanks for solving my "future problem".