If it is a VC or VS compiler, the result is 1, which indicates the number of bytes in the character.
If the result is 2, then there is only one explanation.' A' is an integer constant and an unsigned int. The width of int in the compiler of the landlord is 16 bits and 2 bytes, so it is 2.
Extended data
I. Different definitions
Sizeof is an operator. Typedef in the header file is unsigned int, and its value is calculated at compile time. Parameters can be arrays, pointers, types, objects, functions, etc.
2. Its function is to obtain the byte size that can guarantee to accommodate the largest object created by the implementation. Specifically, when the parameters are as follows, the value returned by sizeof has the following meanings: array-the size of the array space allocated at compile time; Pointer-the space used to store the pointer (the length of the address where the pointer is located is a long integer, which should be 4).
Second, the grammar is different.
1 and strlen are functions that can only be evaluated at runtime. Parameter must be a character pointer. When the array name is passed in as a parameter, the array actually degenerates into a pointer.
2. Its function is to return the length of the string. The string can be user-defined or random in memory. The actual function of this function is to traverse from the first address representing the string until the terminator NULL is encountered. The returned length size does not include NULL.