25. Dynamic Integer Allocation

Back To All Submissions
Previous Submission
Next Submission
#include <iostream>
using namespace std;

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

    // Write your dynamic allocation code here
    int* dyn_x = new int;
    *dyn_x = x;
    cout<<*dyn_x<<endl;
    delete dyn_x;
    dyn_x = nullptr;
    return 0;
}

Solving Approach

 

 

 

 

 

Was this helpful?
Upvote
Downvote