Figure 1A: Example written in C


/* To compile: CRTBNDC PGM(EXAMPLE1A) */
#include <stdlib.h>
#include <string.h>

int main (int argc, char *argv[])
{
  /* allocate 16 bytes of storage from the heap */
  char *ptr = (char*)malloc(16);

  /* set the allocated storage */
  memcpy(ptr, "abcdefghijklmnop", 16);

  /* deallocate storage */
  free(ptr);

  return 0;
}