![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Error C2664: 'ListInt::Insert' : cannot convert parameter 1 from 'ListInt *'...Hello all,
I have tried to see where I have gone wrong here. I cannot seem to fix this error: .\linked.cpp(85) : error C2664: 'ListInt::Insert' : cannot convert parameter 1 from 'ListInt *' to 'ListInt::IntNode *' Here is the code if someone be so kind to look at. Thank you: CPP / C++ / C Code:
|
|||
|
#2
|
|||
|
|||
Re: error C2440 :(Quote:
Here's your definition of the LIstInt::Insert function: CPP / C++ / C Code:
Here's what the compiler is complaining about: CPP / C++ / C Code:
Here is the compiler message that you posted: Code:
Here are my suggestions:
Regards, Dave |
|
#3
|
|||
|
|||
Re: error C2440 :(parameter 1 would concern the "head" part correct?
CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
Re: error C2440 :(From your original message:
Quote:
From function main(): Quote:
|
|
#5
|
|||
|
|||
Re: error C2440 :(Quote:
In this context, the word "parameters" refers to the identifiers inside the parentheses of a function definition. In your function definition, parameter 1 has data type "pointer to ListInt::IntNode" The word "arguments" refers to the identifiers inside the parentheses of a function invocation. Argument number1 in the function invocation has data type "pointer to ListInt" The data types of the arguments must be consistent with the data types of corresponding parameters. See Footnote. In your program they data type of the argument is not the same as the data type of the corresponding parameter, and C++ will not (can not) implicitly convert a pointer to one data type to a pointer to another data type. Therefore: no joy. Regards, Dave Footnote: Sometimes the data type of an argument can be implicitly converted to the data type of the corresponding parameter. C++ compilers try to find cases like that and silently perform the conversion. For example: CPP / C++ / C Code:
This is dealing with numerical values, not pointers, and the conversion works. |
|
#6
|
|||
|
|||
Re: error C2440 :(ok. I got it out of that error but now the numbers are not going into the linked list. I get this error now, which I have to break or continue the program:
An unhandled exception of type 'System.AccessViolationException' occurred in linked.exe Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. CPP / C++ / C Code:
|
|
#7
|
|||
|
|||
Re: error C2440 :(ok.... got it going... here is the code:
CPP / C++ / C Code:
|
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The