title: Tree with multiple child nodes and next node
body: <p>I want to build a tree with the following characteristics:</p>
  
  <ol>
  <li>Every node can have 1 "next node".</li>
  <li>Every node can have multiple child nodes.</li>
  <li>The number of child nodes can vary from one node to the other</li>
  </ol>
  
  <p>I was thinking of a struct which looked like this:</p>
  
  <pre><code>struct tree {
    int value;
    struct tree* nextnode;
    struct tree** childnode;
  };
  </code></pre>
  
  <p>The number of children at each node has to be parametrized. I am not sure how to do this. Thanks in advance!</p>
  
  <p><strong>Edit</strong>: Let me try to define it using an example: Let us take the starting node. Now, I will define at compile time that there will be 3 <code>NextNodes</code> and each of these <code>NextNodes</code> will have 2 <code>ChildNodes</code>. This is at <code>Depth=0</code>. At <code>Depth = 1</code> (i.e. for each child node from <code>Depth=0</code>) I specify that there will be 4 <code>NextNodes</code> and for each of these <code>NextNodes</code> there will be 3 <code>ChildNodes</code> and so on. Hope I am able to convey it properly. Please do ask if I am not clear somewhere.</p>
  
  <p><strong>Edit2</strong>: Here is a pic:</p>
  
  <p><img src="https://i.stack.imgur.com/Uc3QZ.jpg" alt="Here is a pic"></p>