title: How to fix was not declared in this scope error
body: <p>I write a code for printing and finding sum of the nodes in the n-ary tree but I get an error and I cannot fix it.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;queue&gt;
  using namespace std;
  
  class Node
  {
  public:
      Node(int input)
      {
          this-&gt;data = input;
      }
  
      vector&lt;Node*&gt; children;
      int data;
  };
  
  void print(Node *root)
  {
      if (root == NULL)
          return;
  
      queue&lt;Node *&gt; q;
  
      q.push(root);
      int count = 0;
  
      while (q.size() != 0)
      {
          Node *node = q.front();
          cout &lt;&lt; node-&gt;data &lt;&lt; "  ";
          q.pop();
  
          int sum = 0;
          for (unsigned int i = 0; i &lt; node-&gt;children.size(); i++)
          {
              q.push(children[i]);
              sum += (children[i]);
          }
          cout &lt;&lt; " - ";
      }
  
      cout &lt;&lt; "Sum: " &lt;&lt; cout;
  }
  
  int main()
  {
      tree-&gt;children.push_back(new Node(16));
      tree-&gt;children.push_back(new Node(96));
      tree-&gt;children.push_back(new Node(8));
      tree-&gt;children.push_back(new Node(10));
      tree-&gt;children.push_back(new Node(22));
      tree-&gt;children.push_back(new Node(9));
      tree-&gt;children.push_back(new Node(100));
      tree-&gt;children.push_back(new Node(1));
      tree-&gt;children.push_back(new Node(51));
      tree-&gt;children.push_back(new Node(70));
  
      cout &lt;&lt; "Root: " &lt;&lt; tree-&gt;data &lt;&lt; endl &lt;&lt; "Children:" &lt;&lt; endl;
      for (unsigned int i = 0; i &lt; 10; i++)
      {
          cout &lt;&lt; tree-&gt;children[i]-&gt;data &lt;&lt; " ";
      }
      cout &lt;&lt; endl;
  
      print (tree);
  }
  </code></pre>
  
  <p>error: 'children' was not declared in this scope
                   q.push(children[i]);
  How can I fix it?
  What is the meaning of this error?</p>