(1) When the strlen function is used to calculate the length of a string, the strlen result value does not contain '\ 0. When sizeof calculates the length of a string, its result value includes '\ 0 '.
(2) If sizeof is used as an array, only the size of the static array can be measured, and the size of the dynamically allocated or external array cannot be detected.
(3) sizeof is a keyword rather than a function. sizeof occupies an hour of space for computing variables, and brackets can be omitted. The calculation type (model) cannot be omitted for an hour. Of course, it can also calculate the function size. When the calculation function is large, parentheses can be omitted. The size of the calculation function is the number of bytes of the type returned by the function. No return value function. The default size is 1 byte.
(4) the sizeof operation on a variable is the same as the sizeof operation on the address where the variable is located.
Int I = 0;
Sizeof (I) = 4, sizeof (& I) = 4
(5) sizeof () and initial initialization are irrelevant; strlen () is related to initialization.
(6) the sizeof operation results in the number of bytes in the memory space occupied by the operands. strlen returns the length of the string ending with the '\ 0' Terminator.
Char STR [20] = "0123456789 ";
Int A = sizeof (STR) // A = 20;
Int B = strlen (STR) // B = 10;
(7) sizeof is calculated at compilation, and strlen is operated only at runtime.