Length of String Without Strlen in C

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");
while (a[c] != '\0')
printf("Length of the element %d\n", c);
return 0;



Welcome to inlarn

Length of the element