C++ Memory Management Quiz - Question 5

Last Updated :
Discuss
Comments

What is the output of the following C++ code?

C++
#include <iostream>
using namespace std;

int main()
{

    int* ptr = new int;
    *ptr = 10;
    delete ptr;
    cout << *ptr;
}

0

Runtime error

10

Garbage value

Share your thoughts in the comments