27. Dynamic SensorData Allocation

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

// Write your struct and dynamic allocation code here
struct SensorData {
    int x;
    int y;
    int z;
};

int main() {
    int x, y, z;
SensorData* data = new SensorData;
    cin >>data-> x >>data-> y >>data-> z;

cout<<data->x<<" "<<data->y<<" "<<data->z;
delete data;
    // Write your dynamic allocation logic here

    return 0;
}

Solving Approach

 

 

 

 

 

 

Was this helpful?
Upvote
Downvote