C Program to find length of a string without using strlen

You can find the length of a string using the strlen function by including the string.h header file. But what if you want to find the length without using strlen function, then this C program will help you obtaining it.


#include <stdio.h>
int main()

char str[100],i;

for(i=0; str[i]!='\0'; ++i);
printf("\nLength of string: %d",i);

return 0;