In this article I will show to how to find the length of the string || Code with abuzar
As , you know the best way of find the length of the string is Strlen() Function . in this example I will show you how to work strlen() to find the length of the string .
Example :
/* In this program i will
show you how to find
the length of string */
#include<iostream>
#include<cstring>
using namespace std;
int main(){
string str = " c++ was
created by Bjorne Stroustroup ";
/* now you can also use
str.length() , you can use
both of us */
cout<<"string length ="
<<str.length();
return 0;
}
When the above code is compiled and run it , then the output is
Output :
String length = 39
Please ! Write comment if you find anything incorrect in this article .
This article is Contributed by Mohd Abuzar . If you like code wih abuzar or want to contribute with us so mail at - abuzar.abuzar.mohd325@gmail.com
0 Comments
Do not Comment and any spam text