(1 pt) Let’s take an opportunity to practice dynamic memory, pass-by-pointer, and
pass-by-reference. Form groups of 3 and implement the following functions in a new .cpp file
(e.g., dynamic_memory.cpp). Each serves the same purpose—to dynamically allocate an
array of integers and send a pointer storing its base address back to the function caller. The size
of the array should be determined by an integer parameter. The only difference between the
three functions is how they send the pointer back to the caller (return it, or store it in an external
variable via a pointer or reference parameter). Each group member is tasked with implementing
one function, but it is essential for everyone to comprehend all three.
1. // Takes an int argument representing the size of the array,
// and returns the base address of the dynamically allocated
// array
int* create_array1(int size);
2. // Takes a reference to an int pointer, and an int argument
// representing the size of the array. Stores the base address
// of the dynamically allocated array in the int pointer
// that’s supplied via the reference parameter
void create_array2(int*& array, int size);
3. // Takes a pointer to an int pointer, and an int argument
// representing the size of the array. Stores the base address
// of the dynamically allocated array in the int pointer
// that’s supplied via the pointer parameter (i.e., stores the
// base address in the int pointer that the int double-pointer
// parameter points to)
void create_array3 (int** array, int size);