title: How default assignment operator works in struct?
body: <p>Suppose I have a structure in C++ containing a name and a number, e.g.</p>
  <pre><code>struct person {
  
  char name[20];
  
  int ssn;
  
  };
  </code></pre>
  <p>Suppose I declare two <code>person</code> variables:</p>
  <pre><code>person a;
  
  person b;
  </code></pre>
  <p>where <code>a.name = &quot;George&quot;</code>, <code>a.ssn = 1</code>, and <code>b.name = &quot;Fred&quot;</code> and <code>b.ssn = 2</code>.</p>
  <p>Suppose later in the code</p>
  <pre><code>a = b;
  
  printf(&quot;%s %d\n&quot;,a.name, a.ssn);
  </code></pre>