// Pointer task // The program may only contain two variables // Needs to run without memory faults and leaks // create linked list 1,2,3. Swap the the two with a 4. (value in Node is const, so need to swap the Node). struct Node { int const value; Node* next; }; int main() { // Solution, initial structure Node* begin{new Node{3, nullptr}}; begin = new Node{2, begin}; begin = new Node{1, begin}; // Replace second node with a node with value 4 Node* temp{new Node{4, begin->next->next}}; delete begin->next; begin->next = temp; temp = begin; while(begin) { temp = begin->next; delete begin; begin = temp; } }