c use strlen code example
Example 1: c strlen
int my_strlen(char *str) {
int i = -1;
while (str && str[++i]);
return (i);
}
Example 2: length of string c
int main() { char a[100]; int length;
printf("Enter a string to calculate its length\n"); gets(a);
length = strlen(a);
printf("Length of the string = %d\n", length);
return 0; }