First, let's make a multiple-choice question: Is sizeof a keyword or a function?
See the following example:
Int I = 0;
A), sizeof (INT); B), sizeof (I); c), sizeof int; d), sizeof I;
Undoubtedly, the value of a) and B in a 32-bit system is 4. What about C? D?
After debugging, I found that D) is also 4, and c) is an error?
This is because the function name is not followed by parentheses ~ So sizeof is a keyword, not a function ~ Remember: sizeof can be omitted when the space occupied by the computing variable is large, but not when the computing type (model) is large. Exercise: Have you mastered sizeof? (Eclipse compilation in the following 32-bit machine systems) int * P = NULL; char * q = NULL;
What is the value of sizeof (p? What about sizeof (* P? What about sizeof (q? What about sizeof (* q?
Int A [100];
What is the value of sizeof (?
What about sizeof (A [100?
What about sizeof (&? What about sizeof (& A [0?
Int B [100];
Void fun (int B [1, 100])
{
Sizeof (B); // What is the value of sizeof (B?
} Different compiling environments may be different. Please refer to us for more information ~ (⊙ O ⊙) Ah! The answer is as follows ~ Answer: sizeof (p) = 4 sizeof (* P) = 4 sizeof (q) = 4
Sizeof (* q) = 1 sizeof (A) = 400
Sizeof (A [1, 100]) = 4
Sizeof (& A) = 4
Sizeof (& A [0]) = 4
Sizeof (B) = 4