#include <iostream> #include <cstdint> #include <new> using namespace std; struct Block { int id; int value; }; int main() { int id, value; cin >> id >> value; alignas(Block) uint8_t buffer[sizeof(Block)]; Block* pointer = new (buffer) Block; pointer->id = id; pointer->value = value; cout << pointer->id << ' ' << pointer->value; pointer->~Block(); return 0; }
Test Cases
Test Results
Input
7 42
Expected Output