27. Dynamic SensorData Allocation

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

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

SensorData s;



int main() {
    int x, y, z;
    cin >> x >> y >> z;
    SensorData* s =new SensorData;
    s->x=x;
    s->y=y;
    s->z=z;
    // Write your dynamic allocation logic here
  cout << s->x << " " << s->y << " " << s->z;
  delete s;
    return 0;
}

Solving Approach

 

 

 

 

 

 

Was this helpful?
Upvote
Downvote