cbegin(): It returns a read-only (constant) iterator that points to the first character in the string.
Parameter: No parameter required for this function.
Syntax:
string :: const_iterator it = str.cbegin()
For Example:
str = "abc"
str.cbegin() => It returns the iterator to the first character (i.e a)
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){string str = "abc";string ::const_iterator it = str.cbegin();cout << *it << "\n";return 0;}
No comments:
Post a Comment