text: Q:
  
  Why is this method giving two different results?
  
  So I have a class called HugeInt which stores a dynamic array of integers with each place corresponding to a decimal place (arr[0] = 2^0, arr[1] = 2^1...). So I also have this method reverse, which reverses the numbers. But in main it gives two different results, can anyone help? DynArray is the dynamic array class I have created. It just contains an array of int which resizes based on if we are adding to the array. (Cannot use vectors)
  HugeInt HugeInt::reverse(){
      HugeInt hi;
      for (int i = 0; i < this->size; i++){
          hi.dyn.add(this->dyn[this->size - 1 - i]);
      }
      return hi;
  }
  
  My print functions:
  void HugeInt::print(){
      dyn.print();
  }
  
  void DynArray::print(){
      for (int i = 0; i < nextIndex; i++){
          std::cout << arr[i];
      }
  }
  
  my operator=:
  HugeInt& HugeInt::operator=(const HugeInt &b1)
  {
      this->dyn = b1.dyn;
      this->size = b1.size;
      return *this;
  }
  
  When I run this:
  int main(int argc, char *argv[])
  {
      HugeInt hi4("123456");
  
      hi4.print();
      cout << endl;
      cout << endl;
      hi4.reverse().print();
      cout << endl;
      cout << endl;
      hugeInt = hi4.reverse();
      hugeInt.print();
  }
  
  I get these results:
  
  123456
  
  654321
  
  3854321
  
  Why is the last result different from the second result? I am not used to coding in c++ so I feel like it might be some kind of c++ thing I am overlooking?
  UPDATE: 
  ok so I am totally lost now. I changed my reverse() to :
  HugeInt HugeInt::reverse()
  {
      return *this;
  }
  
  and my main as: 
  int main(int argc, char *argv[])
  {
      HugeInt hi4("123456");
  
      hi4.reverse().print();
      cout << endl;
      cout << endl;
      hugeInt = hi4.reverse();
      hugeInt.print();
  }
  
  and get the results
  
  123456
  
  3223456
  
  32 on the ASCII table is 'Space' and 38 is & which is what it was saying before. I'm so lost!
  
  A:
  
  This line in HugeInt HugeInt::reverse() is bad.
  this->~HugeInt();
  
  That means that the first time you call hi4.reverse(), you destroy hi4.
  Every time it's used afterwards is undefined behavior.
  Remove that line.  I can't figure out what you were hoping to do there, but "nothing" is probably a better thing to do there.
  
  