[cpp]
#include <stdio.h>
int mylen(char *str);
int main()
{
char *str = "haha";
printf("len = %d", mylen(str));
return 0;
}
int mylen(char *str)
{
if(str == NULL) return 0;
int len = 0;
for(; *str++ != '\0';)
{
len++;
}
return len;
}
#include <stdio.h>
int mylen(char *str);
int main()
{
char *str = "haha";
printf("len = %d", mylen(str));
return 0;
}
int mylen(char *str)
{
if(str == NULL) return 0;
int len = 0;
for(; *str++ != '\0';)
{
len++;
}
return len;
}