[Solved] How to store a list of numbers in a link list


The compact way:

struct Node
{
    int x;
    Node *next;
} nodes[] = {
    {1, nodes + 1},
    {2, nodes + 2},
    {3, nodes + 3},
    {4, nodes + 4},
    {5, nodes + 5},
    {6, nodes + 6},
    {7, nodes + 7},
    {8, nodes + 8},
    {9, nullptr}
};
Node* root = nodes;

solved How to store a list of numbers in a link list