Hi guys. I have a question - searched for it for at least an hour (i think more, but nevermind).
I have this piece of code:
cout << word.getLastWord() << "<---" << '\n';
It is supposed to call getLastWord method of class called Extract.
Method returns a pointer to the next word extracted form the text. No problem with that. I use this command to "parse" the whole text, but when I'm done with parsing text, if I continue calling the function it goes in depths of my computer's memory.
So, I decided to make a small correction. Include a part of code to make sure that function returns NULL pointer after reaching NULL pointer once (ie after reaching the end of the text).
Problem is that when I call the mentioned piece of code (after calling it many times and reaching the end of text) , nothing is outputted to the screen. So, I am guessing that outputting NULL pointing pointer makes that mess.
I'm new to C++. I have used C so far, so I cannot localize the problem.
Thank you all in advance.
Edited 6 Years Ago by Alibeg: n/a