C Program to Find Length of String Without using strlen Function

In this post, we will see how to find length of String without using library function.

You can easily find length of String using strlen function but we won’t use strlen function and will find out length of String without using library function.

Here is simple program by which you can find length of String.

Output:

Enter the string:code2master
Length of string is :11

Explanation

You might know that string in c ends with ‘\0’ char, so we are iterating over string and once we get the ‘\0’, while loop condition became false and it will exit the loop.

That’s all about finding Length of String Without using Library Function in C.

Leave a Reply

Your email address will not be published. Required fields are marked *