strlen的函数实现(linux)如下: 378/** 379 * strlen - Find the length of a string 380 * @s: The string to be sized 381 */ 382size_t strlen(const char *s) 383{ 384 const char *sc; 385 386 for (sc = s; *sc != '/0'; ++sc) 387 /* nothing */; 388 return sc - s; 389} sizeof是在编译的时候就已经确定好的大小。