Question:
How do i solve the errors for this doubly linked structured list in c?
1970-01-01 00:00:00 UTC
How do i solve the errors for this doubly linked structured list in c?
Three answers:
?
2016-05-25 12:29:36 UTC
ANY working example from the Web would be likely to have "a lot of errors on it" when you tried compiling it. Just having compile errors doesn't mean the program doesn't work, just that it was written and debugged with a different compiler or configuration and has to be "ported" to yours. The next one you downloaded would be just as likely to have to be retrofitted to your machine as this one has. This is a programming truism. Maybe if you used the code as a tutorial you could figure out how to code it on your compiler. Hope that helps.
richg74
2008-07-17 08:17:24 UTC
If you want help fixing a problem with your program, you really need to show it to us -- the program, not just the error messages.



From this limited information, it appears that you are having problems with data types. The first message says that the compiler can't convert a [function] parameter from type 'ListNodePtr' to type 'pointer to ListNodePtr'. The second error says that type 'pointer to void' (a generic object pointer) can't be converted to type 'ListNodePtr'.



Probably, at a minimum, you have been careless with your data type definitions; but without the actual program, it's very hard to be more specific.
JoelKatz
2008-07-17 08:07:29 UTC
The first message is not an error. It's a warning. You are free to ignore it. The others are run-of-the-mill C++ coding errors.



The second message is telling you that you are passing 'isEmpty' a 'ListNodePtr' when the function is defined to take a 'ListNodePtr *'. You probably have a missing '&' before the parameter in the function call, but it's hard to be sure from just the error.



The last message is telling you that you are comparing a void pointer to a 'ListNodePtr'. While I would presume a 'ListNodePtr' is a pointer to a list node (just from its name), it is not a pointer as far as the language is concerned and can't be compared to a pointer, since the compiler doesn't know how to get the pointer out of the class.



Again, it's hard to know the right fix without seeing your code. Odds are, a cast is not the right fix in this case. More likely, you want to call some function that gets the internal pointer out of the ListNodePtr instance.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...