#include <stdio.h>
#define MAX 100
int lenstr(char *str)
{
int len =0;
int i =0;
if(*str=='\0')
return len;
while(*(str+i)!='/0')
{
++len;
i++;
}
return len;
}
int main()
{
char a[MAX];
printf("Please enter the string:\n");
scanf("%s",a);
printf("The length of this string is %d\n",lenstr(a));
return 0;
}
|