Hey guys, I have a function that compares two dynamic arrays and returns true or false if they're identical.
bool Identical(QueType que1, QueType que2)
{
if (que1.IsEmpty() != true && que2.IsEmpty() != true)
{
cout << "in loop\n" ;
ItemType tmp1 ;
ItemType tmp2 ;
que1.Dequeue(tmp1) ;
que2.Dequeue(tmp2) ;
if (tmp1 == tmp2)
Identical(que1, que2) ;
else
return false ;
que1.Enqueue(tmp1) ;
que2.Enqueue(tmp2) ;
}
return true ;
}
I keep getting a runtime error at the very end of this code. I know it's when the function exits because I've put cout << statements at the very end before it returns to main().
I assume this has something to do with the copying being shallow instead of deep, and it's trying to destruct already-destrcuted memory... but i'm not sure.
Please help!