Memory allocation (original) (raw)

next up previous contents
Next: Array fill/copy Up: The Common Package Previous: Bit arrays Contents

  #include <gandalf/common/allocate.h>

Gandalf provides some macros to simplify access to the standard malloc()and realloc() functions. So for instance to allocate an array of a hundred integers you can use

  int *aiArray;

  aiArray = gan_malloc_array ( int, 100 );

instead of the usual

  int *aiArray;

  aiArray = (int *) malloc ( 100*sizeof(int) );

2006-03-17