1 #include<iostream>
2 #include<string.h>
3 using namespace std;
4 int strlen1(const char *strDest);
5 int main()
6 {
7 const char *strDest = "hello world";
8 int length = strlen1(strDest);
9 cout<<length<<endl;
10 cout<<strlen(strDest)<<endl;
11 }
12
13 int strlen1(const char *strDest)
14 {
15 int len = 0;
16 while(*strDest++ != '\0')
17 {
18 len ++;
19 }
20 return len;
21 }
2 #include<string.h>
3 using namespace std;
4 int strlen1(const char *strDest);
5 int main()
6 {
7 const char *strDest = "hello world";
8 int length = strlen1(strDest);
9 cout<<length<<endl;
10 cout<<strlen(strDest)<<endl;
11 }
12
13 int strlen1(const char *strDest)
14 {
15 int len = 0;
16 while(*strDest++ != '\0')
17 {
18 len ++;
19 }
20 return len;
21 }