length(): It returns the number of characters in the string, not including any
null-termination in the string.
Parameters: No parameters are required for this function.
Syntax:
str.length()
For Example:
str = "abc"
str.length() = > It returns 3
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){string str = "abc";cout << str.length() << "\n";return 0;}
No comments:
Post a Comment