1. segment Error
When a function is executed once, no error is reported. When a function is called iteratively in a loop, a segment error is returned.
Error cause.
Int Weight = 0;
Fprintf (ferr, "% s \ t % F \ t % s \ n", word, weight, hzpy );
If this statement is changed to fprintf (ferr, "% s \ t % d \ t % s \ n", word, weight, hzpy), no error is returned.
2. Double-layer Hash
If (defined ($ hashtobeupdate {$ VEC [1]})
126 {
127 If (defined ($ hashtobeupdate {$ VEC [1]} {$ VEC [0]}) & $ VEC [2]> 0)
128 {
129 $ hashtobeupdate {$ VEC [1]} {$ VEC [0]} + = $ VEC [2];
130 print stdout "$ VEC [1] \ t $ VEC [0] \ t $ hashtobeupdate {$ VEC [1] }{$ VEC [0]} \ n ";
131
132}
133}
Note:For a double-layer Hash, you must first check whether the first-layer key exists. Otherwise, the data is automatically inserted and the memory size increases.
2. Two string initialization Methods
CHar word [max_line_length] = {0 };
Char * word = new char [max_line_length];
Memset (word, 0, max_line_length );