title: Size of a struct datatype
body: <pre><code>struct node
  {
  int value;
  node *next=NULL;
  };
  
  node *foo;
  foo = new node;
  
  cout&lt;&lt; "\nsize of node: " &lt;&lt; sizeof(foo);
  cout&lt;&lt; "\nsize of node-&gt;value: " &lt;&lt; sizeof(foo-&gt;val);
  cout&lt;&lt; "\nsize of node-&gt;next: " &lt;&lt; sizeof(foo-&gt;next);
  </code></pre>
  
  <p><b>Output</b></p>
  
  <pre><code>size of node: 8 bytes
  size of node-&gt;val: 4 bytes
  size of node-&gt;next: 8 bytes
  </code></pre>
  
  <p>The above snippet is for Singly Linked List.<br>
  The size of <b>node</b> based on its contents are  4 + 8 = 12 bytes. Then how its size is 8 bytes ?. I cant understand the concept behind this.  </p>