#include<iostream.h>
#include<string.h>
int
main(void)
{
char* p = "hello";
int len1 = strlen(p); //---------5
int len2 = sizeof(p); //----------4
typedef struct Test{
int a;
char b;
};
int len3 = sizeof(Test); //---------8
cout<<len1<<" "<<len2<<" "<<len3<<endl;
}
总结:strlen---->实实在在的字符串长度,例如 hello----〉5
sizeof(p)--------〉4