Instead of
NodeSmall *docNum = new NodeSmall;
you have to use
head->docNum = new NodeSmall;
kbshibukumar
Junior Poster in Training
65 posts since Jan 2009
Reputation Points: 12
Solved Threads: 8
When you say NodeSmall *docNum = new NodeSmall; a new NodeSmall is created in memory and head->docNum will not point to the same. Hence, head->docNum will be NULL and as you tried to access an element of NULL, the program crashed.
kbshibukumar
Junior Poster in Training
65 posts since Jan 2009
Reputation Points: 12
Solved Threads: 8