Practice examples: resizable arrays

Complete the functions below to allocate/resize arrays:

  1. Allocating an array of floats:
    // try to allocate an array of floats of the specified size
    //    returning a ptr to the allocated space 
    //    (NULL if unsuccessful)
    float* allocateFloatArray(int size)
    

  2. Resizing an array of chars:
    // given an array of chars of size oldSize,
    //    allocate a new array of size newSize
    // if allocation succeeds
    //    copy the old contents into the new contents,
    //    deallocate the old space,
    //    set cPtr to point to the new space,
    //    and return true
    // otherwise leave cPtr untouched and return false
    bool resizeCharArray(char* &cPtr, int oldSize, int newSize)