c++ - How to define class for Trie in cpp -


hi new oops in cpp. define class trie node follows. error , couldnot find wrong. in advance.

error : line 5: expected identifier before numeric constant

class node {         public:             bool end;             char val;             vector<node *> children(26);         node(char val)         {             val=val;             end=false;             for(i=0;i<children.size();i++)                 children[i]=null;         } }; 

should be

     vector<node *> children; node(char val) : end(false), val('\0'), children(26) {     // ... 

use member initializer list call specific member variable constructors.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -