Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Declare a pointer variable named arrayPtr and dynamically allocate memory for an array of 5 integers using the new operator.

  2. Assign values to the array elements (e.g., 1, 2, 3, 4, 5).

  3. Print the values of the array elements using the pointer.

  4. Deallocate the memory using the delete[] operator and set arrayPtr to nullptr.

  5. Print a message confirming the memory deallocation.

Use the following code starter to complete your lab. Please make sure you add the C++ code under the pseudo-coded instructions:

...