It’s not just better, it’s the only possible way.
If you stored a Node
object inside itself, what would sizeof(Node)
be? It would be sizeof(int) + sizeof(Node)
, which would be equal to sizeof(int) + (sizeof(int) + sizeof(Node))
, which would be equal to sizeof(int) + (sizeof(int) + (sizeof(int) + sizeof(Node)))
, etc. to infinity.
An object like that can’t exist. It’s impossible.