Medium
Two nodes pointing at each other
What does this program print?
main.cpp
#include <iostream>
#include <memory>
struct Node {
std::shared_ptr<Node> next;
~Node() { std::cout << "destroyed\n"; }
};
int main() {
auto a = std::make_shared<Node>();
auto b = std::make_shared<Node>();
a->next = b;
b->next = a;
std::cout << "end of main\n";
}16 of 117 in C++