#include <iostream> const int* ptr = nullptr; typedef struct { int x; int y; int z; } SensorDatatype_t; void print_data(const SensorDatatype_t& d) { // d.x = 99; // will NOT compile (read-only) std::cout << d.x << " " << d.y << " " << d.z << '\n'; // Store address of original x safely ptr = &d.x; } int main() { SensorDatatype_t d; std::cin >> d.x >> d.y >> d.z; print_data(d); // Verification (optional) if (ptr == &d.x) { // success } return 0; }
Test Cases
Test Results
Input
3 4 5
Expected Output