title: (C++) Does a new declaration of an already existing object erase data?
body: <p>I am currently programming a piece of code that heavily uses structs in c++. </p>
  
  <p>I found nothing about this online, so I am asking the question here:
  if I redefine an already existing object, is all data of this object erased?</p>
  
  <p>My code looks something like this:</p>
  
  <pre><code>struct someStruct{
  int someInt = 0; //some other data here
  }
  
  int main(){
     while(someCondition){
        someStruct newStruct;
        //do stuff with Struct, like:
        newStruct.someInt=1;
        //use newStruct somewhere else
     }
  }
  </code></pre>
  
  <p>My question here is, whether the new declaration in the second run-through of the while loop keeps the data of the previously used object or erases it. (Do I have to delete unwanted data in newStruct or not? Is this an application of new and delete)</p>
  
  <p>Thanks in advance!</p>