CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Unfreed Heap Memory

C++ quiz · Question 21
easyDynamic Memory

This code compiles and runs, but it has a problem. What is the issue?

Code

1#include <iostream>
2using namespace std;
3 
4void createValue() {
5 int* p = new int(42);
6 cout << *p << endl;
7}
8 
9int main() {
10 createValue();
11 return 0;
12}