Why is there some ambiguity in the way sizeof() function works in C++, when using struct : <pre><code>struct node
{
  int data;
  struct node *next;
}

cout&lt;&lt;sizeof(struct node)&lt;&lt;sizeof(node)&lt;&lt;endl; 
//no error, C++ allows us to use sizeof(struct node) and sizeof(node) both. 
</code></pre>

<p>Whereas we cannot do the same with int datatype</p>

<pre><code>int a;
cout&lt;&lt;sizeof(int) &lt;&lt;sizeof(a) &lt;&lt;endl;//there is no error here

  //BUT

cout&lt;&lt;sizeof(int a) &lt;&lt;endl;//this throws an error 
</code></pre>

<p>I understand that "struct node" itself is like a datatype which can be used to declare variable of type "struct node". Going by the behavior of how sizeof() works with int, it is understandable that sizeof(struct node) is equivalent to sizeof(datatype) and hence is correct usage. </p>

<p>But how does sizeof(node) work as well ? It does not throw any error. "node" in itself cannot be used to declare any other variables, it needs to be "struct node" to declare a variable.</p>
