Complete the code to allocate memory for an integer using the new operator.
int* ptr = [1] int;The new operator allocates memory for an integer and returns a pointer to it.
Complete the code to allocate an array of 5 doubles using the new operator.
double* arr = [1] double[5];
The new operator allocates memory for an array of doubles.
Fix the error in the code to correctly allocate a single float using new.
float* fptr = [1] float();
The new operator correctly allocates and initializes a float.
Fill both blanks to allocate and initialize an array of 3 integers with zeros using new.
int* arr = [1] int[2];
The new operator with square brackets allocates an array of integers.
Fill all three blanks to allocate an array of 4 chars and initialize them to zero using new.
char* buffer = [1] char[2] [3];
The new operator with brackets allocates an array, and braces initialize all elements to zero.