title: How can I new and initialize a struct in C++?
body: <p>In C, we actually do</p>
  
  <pre><code>struct node *p = (node*)malloc(sizeof(node));   // casting is not necessary
  p-&gt;a = 0;      // first  element
  p-&gt;b = NULL;   // second element
  </code></pre>
  
  <p>to dynamically allocate spaces in the memory, but how can I do this in C++ way?</p>
  
  <p>Is the line below a correct guess?</p>
  
  <pre><code>node *p = new node {0, NULL};
  </code></pre>