title: Why is the compiler throwing this warning: "missing initializer"? Isn't the structure initialized?
body: <p>I'm creating some sort of frontend for a program. To launch the program I'm using the call <code>CreateProcess()</code>, which among other things receives a pointer to a <code>STARTUPINFO</code> structure. To initialize the structure I used to do:</p>
  <pre><code>STARTUPINFO startupInfo = {0}; // Or even '\0'.
  startupInfo.cb = sizeof(startupInfo);
  </code></pre>
  <p>When compiling the program with GCC enabling these sets of warnings <code>-Wall -Wextra</code> it gives me a warning saying that there's a missing initializer pointing to the first line.</p>
  <pre class="lang-none prettyprint-override"><code>warning: missing initializer
  warning: (near initialization for 'startupInfo.lpReserved')
  </code></pre>
  <p>So I ended up doing:</p>
  <pre><code>STARTUPINFO startupInfo;
  memset(&amp;startupInfo, 0, sizeof(startupInfo));
  startupInfo.cb = sizeof(startupInfo);
  </code></pre>
  <p>And this way the compiler doesn't give any warning.
  The question is, what is the difference between these ways of initializing a structure?
  Using the first method, isn't the structure initialized?
  Which one would you recommend?</p>