Dynamic Integer Allocation

#include <iostream>
using namespace std;

int main() {
    int x;
    cin >> x;

    int* pointer = new int;
    *pointer = x;
    
    cout << *pointer;

    delete pointer;
    pointer = nullptr;

    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

42

Expected Output

42