Re: help me in this code ..
Hi,
in your attachement there are 2 headers and one source file. Since that is not a compileable project, what do you expect us to do?
Isn't it possible to tell us the error? Post the code (in code tags) and tell us the error you got.
I do not have the time to build a project out of your files...
With regards
Programartist
Re: help me in this code ..
sorry for that
the error is her (((((( secondList = first;)))))
void linkedListType<Type>::splitAt(linkedListType &secondList,
const Type& item)
{
//void splitAt(List <Type> &seclist, const Type &item){
nodeType<Type> * first;
nodeType<Type> * link;
nodeType<Type> *pNode = first ;
bool found = false;
if (isEmptyList())
cout<< "The List is empty\n";
else
for (pNode = first; pNode != NULL; pNode = pNode->link)
if (item == pNode->info){
first = pNode;
secondList = first;
found = true;
}
if (found = false){cout<<"Item not found";}
}
#endif
Re: help me in this code ..
Re: help me in this code ..
Code:
nodeType<Type> * first;
nodeType<Type> *pNode = first ;
Always initialize your variables.
Code:
nodeType<Type> * first = NULL;
nodeType<Type> *pNode = first ;
Now you can see, 'first' is nothing, so 'pNode' also is nothing.
Code:
secondList = first;
'secondList' is a refference, not a pointer. Also, it is of a different type.