I was trying to send the address of a string to a function in C++ I'm but facing problems like in the code below:
#include<iostream>
#include<string>
using namespace std;
void try2(string *a){
     cout<<a[2];
}
int main(){
    string a;
    getline(cin,a);//string length is greater than 10
    try2(&a);
}
I am doing the same that we do for string in C. But I don't have that much idea about C++. Please suggest and describe how string behaves in C++.
 
     
    