sizeof is the keyword is not a function, in fact, even if you do not know whether it is 32 keywords, we can also use the compiler to determine its identity. Look at the following example:
int i=0;
A), sizeof (int); B), sizeof (i); C), sizeof int; D), sizeof I;
There is no doubt that the value of the 32-bit system under a), B) is 4. What about the C)? D)? Under the 32-bit system, we found that the result of D was also 4.
Hey? What about the parentheses behind sizeof? Without parentheses, you can do it, so think about the function name without parentheses. It is easy to conclude that sizeof is not a function.
OK, look at C again). How does the compiler suggest an error? Not that sizeof is a keyword, and that the parentheses behind it are not available? Well, what do you think about sizeof int? int preceded by a keyword? Type extension? Obviously incorrect, we can add unsigned,const and other keywords before int but cannot add sizeof.
<blockquote> Well, remember: sizeof the parentheses can be omitted when calculating the space size of the variable, and the type (die) size cannot be omitted. Under normal circumstances, we also do not steal this lazy, obediently write the parentheses, continue to act as a "function", do a "phi function skin keyword." </blockquote>
Do my keywords and let people think it's a function to go.
Leave a few questions (explained in detail with pointers and arrays), under 32-bit systems:
int *p = NULL;
What is the value of sizeof (p)?
What about sizeof (*P)?
int a[100];
What is the value of sizeof (a)?
What about sizeof (a[100])? Please pay particular attention to this example.
What about sizeof (&A)?
What about sizeof (&a[0])?
int b[100];
void fun (int b[100])
{
sizeof (b);//What is the value of sizeof (b)?
}
The most wronged keyword----sizeof