Re: [Code] Help bug

From: Mike Breuer (
Date: 11/29/01

From: "John" <witpens@OPTUSHOME.COM.AU>
> free(world[top_of_world]); (this crashes here)
> top_of_world--;
>  RECREATE(world, struct room_data, top_of_world);
>  top_of_world--;

I'm not sure I fully understand what you're asking, especially since the top
two lines quoted here do not appear in your example code.  RECREATE calls
realloc, which, in the case of the second pair of lines,  reduces the size
of the world array.  It would never be appropriate to call
free(world[top_of_world]).  In fact, it would never be appropriate to free
any of the array elements.  This is because world is an array of structures,
and not an array of pointers.  It IS appropriate to allocate and free the
pointers within the structure, but not the function pointer (as noted by the
previous poster).


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST