string的问题
leboc 2008-11-13 07:59:06 #include <iostream>
#include <string>
using namespace std;
int strlenTest(const char *p)
{
int i=0;
while(p[i])//________________________这里改成while(*p) 为什么就不行呢?
++i;
return i;
}
int main()
{
string a="hello";
cout<<strlenTest(a.c_str());
return 0;
}