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 *ptr = new int(x);
    cout << *ptr;
    delete ptr;

    return 0;
}
Was this helpful?
Upvote
Downvote