Figure 1B: Example written in C++
/* To compile: CRTBNDCPP PGM(EXAMPLE1B) */
#include <string.h>
int main (int argc, char *argv[])
{
/* allocate 16 bytes of storage from the heap */
char *ptr = new char[16];
/* set the allocated storage */
memcpy(ptr, "abcdefghijklmnop", 16);
/* deallocate storage */
delete [] ptr;
return 0;
}