#include<stdio.h>
int string_length(char *a)
{ int i=0;
while(*a!='\0')
{ i++;
a++;
}
return i;
}
int main()
{
char *s;
int l;
printf("enter a string\n");
gets(s);
l=string_length(s);
printf("l=%d",l);
}
Note: Need to be arranged in compiler after copied
OutPut:
enter a string
Hello
l=5