I give two lists l1, l2 with data [1,1,1] and [2,2,2], respectively.
While I do l1+=l2, it runs the program below.
But, while it's doing return *this, it will show segmentation fault:11
List List::operator+=(const List &other){
unsigned int min_len = (this->_len < other._len) ? _len : other._len;
for (int i = 0; i < min_len; i++){
this->_Array[i] += other._Array[i];
}
return *this;
}
I have no idea why it got this error.
However, if I change "return *this" to "return 0", it can work.
Another problem is that I try to change List to List&, it got another address problem.