sizeof操作符的结果类型为size_t(The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). This keyword returns a value of type size_t.)(它在头文件用typedfe定义为unsigned int类型),计算的是分配空间的实际字节数;strlen结果类型也为size_t(size_t strlen( const char *string )),但strlen是计算的空间中字符的个数(不包括‘\0’)。
sizeof和strlen的区别:sizeof操作符的结果类型为size_t(The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). This keyword returns a value of type size_t.)(它在头文件用typedfe定义为unsigned int类型),计算的是分配空间的实际字节