C Programming Code Examples C > Strings Code Examples program to find the length of a String without using function strlen() program to find the length of a String without using function strlen() In the following C program we are counting the number of characters in a given String to find out and display its length on console. Upon execution of this program, the user would be asked to enter a string, then the program would count the chars and would display the length of input string as output. C Program - finding length of a String without using standard library function strlen #include <stdio.h> int main() { /* Here we are taking a char array of size 88 which means this array can hold a string of 88 chars. You can change this as per requirement */ char str[88],j; printf("Enter a string: \n"); scanf("%s",str); // '\0' represents end of String for(j=0; str[j]!='\0'; ++j); printf("\nLength of input string: %d",j); return 0; }