What's the difference between
1) node *Trie=new node(); and 2) node *Trie = new node;
no difference.
new Node() zero initializes the data, i.e. match will be false,
and all of the pointers will be NULL. new Node doesn't; the
contents are undefined, and reading them (before having set them
otherwise) is undefined behavior.
--
James Kanze (GABI Software) email:james...@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Btw, is there anything equivalent for allocating arrays?
Sure.
// allocates uninitialized ints
int* arry1 = new int[100];
// allocates ints initialized to 0 on recent (=conformant) compilers
int* arry2 = new int[100]();
// allocates ints initialized to 0 on all compilers
std::vector<int> arry3(100);
--
Thomas