delete c++

#include <iostream>

int main() {
    // Step 1: Dynamically allocate memory for an integer
    int* dynamicInteger = new int;

    // Step 2: Assign a value to the dynamically allocated integer
    *dynamicInteger = 42;

    // Step 3: Output the value of the dynamically allocated integer
    std::cout << "Dynamically allocated integer value: " << *dynamicInteger << std::endl;

    // Step 4: Deallocate the dynamically allocated memory
    delete dynamicInteger;

    return 0;
}