Dynamic SensorData Allocation

#include <iostream>
using namespace std;

// Write your struct and dynamic allocation code here
struct Sensor
{
    int x;
    int y;
    int z;
} ;
int main() {
    int x, y, z;
    cin >> x >> y >> z;

    // Write your dynamic allocation logic here
    Sensor* a = new Sensor;
    a->x = x;
    a->y = y;
    a->z = z;
    cout << a->x << " " << a->y << " " << a->z << std::endl;

    return 0;
}

Solving Approach

 

 

 

 

 

 

Upvote
Downvote
Loading...

Input

3 4 5

Expected Output

3 4 5