25. Dynamic Integer Allocation

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

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

    //Dynamic Allocation
    int* val = new(int);
    *val = x;

    cout << *val;

    delete(val);

    return 0;
}

Solving Approach

 

 

 

 

 

Was this helpful?
Upvote
Downvote