Problems with "searching a list"

Good afternoon misters and ladies.

I am having some problems trying to do a c++ problem. I am meant too have a do + switch that will ask me for a word, look for that word in a list thats previously created and tell me if that word is on that list or not.

This is what I have at the moment:

http://pastebin.com/8gJcWUe4
http://pastebin.com/jpqtmT00

The first part of the code its used outside of the main function and its supposed too tell me if a word exists in a list or not.

The second part its where I use a do +case 5 + break and call the function, calling for the person too input a word, calling the function "pesquisa" and look if the word is there or not.


Our problem is that the programa crash after we try too look for the word.

I am aware that I am not the best and knowledge person in c++, soo if anyone need any more information or even the full code of the work we are trying to do, I have no problems in editing this post as needed.

Thank you in advance.
In return ptr->dados;, should you not be returning the address of the data, as: return &(ptr->dados);? (This is probably the reason your program is crashing, because your "print word" function expects a pointer value, correct?)

While it doesn't change the functionality of your program, I also recommend you fully prototype the comparison function argument:

void* pesquisa(PNO cabeca, int (*compara)(void*, void*), void* valor)

Hope this helps.
Topic archived. No new replies allowed.