C program to find the length of the string without strlen function

C program to find the length of the string without strlen function. The strlen() method determines how long a string is. In the string. h header file, the strlen() method is defined. The null character ‘0’ is not counted. You can also find the length of a string without using the strlen function. To find it, we construct a function. We read all of the characters in the string and increment the number by one if the character isn’t a null character. The counter equals the length of the string once the null character is discovered.

#include <stdio.h>
int main()
{
char a[1000];
int c = 0;
printf("Enter the element\n");
gets(a);
while (a[c] != '\0')
c++;
printf("Length of the element %d\n", c);
return 0;
}

Output:

Welcome to inlarn

Length of the element 

14