Quiz · Memory and Smart Pointers · lesson 2 of 12
Quiz — using an object after delete
What happens when this program runs?
#include <iostream>
int main() {
int* p = new int{42};
int* q = p;
delete q;
std::cout << *p << '\n';
}Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.