27. Dynamic SensorData Allocation

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

struct SensorData {
    int x,y,z;
};

int main() {
    int x, y, z;
    cin >> x >> y >> z;

    auto ptr = new SensorData;
    ptr->x = x;
    ptr->y = y;
    ptr->z = z;

    cout << ptr->x << " " << ptr->y << " " << ptr->z;

    return 0;
}

Solving Approach

 

 

 

 

 

 

Was this helpful?
Upvote
Downvote