如下:
#include<stdio.h>
int length(char* s)
{
int n=0;
while(*(s+n )!='\0')
n++;
return n;
}
int main()
{
char str[]="book";
printf("length=%d\n,length(str));
return 0;
}
如下:
#include<stdio.h>
int length(char* s)
{
int n=0;
while(*(s+n )!='\0')
n++;
return n;
}
int main()
{
char str[]="book";
printf("length=%d\n,length(str));
return 0;
}