C++ Program to Find Length of String

Here we will see various ways to find length of string in C++. We can do this in two ways, one is by using inbuilt functions such as length(), and size(), and another way is to find using a loop manually.

Method 1: Using length() or size()

Output:

Length of the string is: 20
Length of the string is: 20

Method 2: Using Loop

We can use any loop to iterate through the string to find its length.

Output:

Length of the string is: 11

7 thoughts on “C++ Program to Find Length of String”

    1. I guess you did not read the title of the blog. It clearly says “Without using Library functions”. The function “strlen()” is library function.

Leave a Comment

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