title: C++ Structure Initialization
body: <p>Is it possible to initialize structs in C++ as indicated below:</p>
  <pre><code>struct address {
      int street_no;
      char *street_name;
      char *city;
      char *prov;
      char *postal_code;
  };
  
  address temp_address = { .city = &quot;Hamilton&quot;, .prov = &quot;Ontario&quot; };
  </code></pre>
  <p>The links <a href="http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/strin.htm" rel="noreferrer">here</a> and <a href="https://stackoverflow.com/questions/5790534/static-structure-initialization-with-tags-in-c">here</a> mention that it is possible to use this style only in C.  If so why is this not possible in C++?  Is there any underlying technical reason why it is not implemented in C++, or is it bad practice to use this style.  I like using this way of initializing because my struct is big and this style gives me clear readability of what value is assigned to which member.</p>
  <p>Please share with me if there are other ways through which we can achieve the same readability.</p>
  <p>I have referred the following links before posting this question:</p>
  <ol>
  <li><a href="http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/strin.htm" rel="noreferrer">C/C++ for AIX</a></li>
  <li><a href="https://stackoverflow.com/questions/7700878/c-structure-initialization-with-variable">C Structure Initialization with Variable</a></li>
  <li><a href="https://stackoverflow.com/questions/5790534/static-structure-initialization-with-tags-in-c">Static structure initialization with tags in C++</a></li>
  <li><a href="https://stackoverflow.com/questions/9557464/c11-proper-structure-initialization">C++11 Proper Structure Initialization</a></li>
  </ol>