title: zeroing memory area of a structure in c
body: <p>I have following structure and i want to initialize it to zero.</p>
  
  <pre><code>struct example {
       int a;
       int b;
       char c;
  };
  struct example mystruct;
  </code></pre>
  
  <p>I can memset mystruct to zero in following ways:</p>
  
  <pre><code>memset(&amp;mystruct, 0, sizeof(mystruct));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>mystruct = (struct example) {0};
  </code></pre>
  
  <p>Is the second way is equal to the first one?</p>
  
  <p>Note that i want to initialize mystruct variable to zero not only at variable definition, maybe for reusing it. </p>