front(): It returns a read/write reference to the data at the first
element of the string.
Parameters: No parameters are required for this function.
Syntax:
str.front()
For Example:
str = "abc"
str.front() = >It points to the first character (i.e a)
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){string str = "abc";cout << str.front() << "\n";return 0;}
No comments:
Post a Comment