Complete the functions below to allocate/resize arrays:
// 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) |
// 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) |