[prev] [index] [next]

The malloc() function (cont)

Things to note about   void *malloc(size_t):
  • it is defined as part of  stdlib.h
  • its parameter is a size in units of bytes
  • its return value is a generic pointer  (void *)
  • the return value must be cast to an appropriate type
  • the return value must always be checked   (may be NULL)
Size is determined by   #Elements * sizeof(ElementType)