Dynamic SensorData Allocation

#include <iostream>
using namespace std;

// Write your struct and dynamic allocation code here
struct SensorData{
    int a,b,c;


};



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

    // Write your dynamic allocation logic here
    SensorData* s = new SensorData;
    s->a = x;
    s->b = y;
    s->c = z;
    cout<<s->a<<" "<<s->b<<" "<<s->c;
    delete s;
    return 0;
}

Solving Approach

 

 

 

 

 

 

Upvote
Downvote
Loading...

Input

3 4 5

Expected Output

3 4 5