Right...and I mean to copy the data, not just a pointer to it, through the overloaded assignment operator, i.e.creating a whole new linked list with the exact same contents as list 1.
I am trying to overload the Assignment and Copy operators for a simple linked list class. It seems I can only copy the pointers, when I delete the original list, my program has errors.
Here's the code:
#include <iostream>
using namespace std;
struct link
{
int data;
link* next;
}...
Why does the following code not work? It compiles just fine, but s doesn't seem to take.
I want to copy the string str to char* s.
string str;
char* s=" ";
cout<<"\nEnter String: ";
cin>>str;
int len = str.size();
for(int j=0; j<len; j++)
{
if(str[j] >= '0' && str[j] <= '9' ||...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.