title: Count word in trie implementation
body: <p>I'm implementing a trie to implmenta spelling dictionary. The basic element of a trie is a trienode, which consists of a letter part (char), a flag(whether this char is the last char of a word), and an array of 26 pointers.</p>
  
  <p>Private part of the TrieNode class include:</p>
  
  <pre><code>ItemType item;//char
  bool isEnd;//flag
  typedef TrieNode* TrieNodePtr;
  TrieNodePtr myNode;
  TrieNodePtr array[26];//array of pointers
  </code></pre>
  
  <p>This is part of the test call:</p>
  
  <pre><code>Trie t4 = Trie();
  t4.insert("for");
  t4.insert("fork");
  t4.insert("top");
  t4.insert("tops");
  t4.insert("topsy");
  t4.insert("toss");
  t4.print();
  cout &lt;&lt; t4.wordCount() &lt;&lt; endl;
  </code></pre>
  
  <p>Right now I'm trying to traverse the trie to count how many words there are (how many flags are set to true).</p>
  
  <pre><code>size_t TrieNode::wordCount() const{
      for (size_t i = 0; i &lt; 26; i++){
          if (array[i] == nullptr){
              return 0;
          }
          if (array[i]-&gt;isEnd &amp;&amp; array[i] != nullptr){
              cout &lt;&lt; "I'm here" &lt;&lt; endl;
              return 1 + array[i]-&gt;wordCount();
          }
          else if(!array[i]-&gt;isEnd &amp;&amp; array[i]!=nullptr){
              cout &lt;&lt; "I'm there" &lt;&lt; endl;
              return 0 + array[i]-&gt;wordCount();
          }
          else{
              // do nothing
          }
      }
  }
  </code></pre>
  
  <p>Every time the function returns 0. I know it's because when the first element in the array is null, then the function exits, so the count is always 0. But I don't know how to avoid this, since every time I have start from the first pointer. I also get a warning:not all control paths return a value. I'm not sure where this comes from. How do I make the function continue to the next pointer in the array if the current pointer is null? Is there a more efficient way to count words? Thank you!</p>