C++ Program to Find Length of String Without Using Library Function

Here you will get C++ program to find length of a string without using library function.

We iterate through the string until null character ‘\0’ is encountered and increase a counter variable for each iteration. Finally print the counter variable, it contains the length of string.


Enter a string:hello hi

Length of the string ‘hello hi’ is 8

Leave a Reply

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