jeudi 28 décembre 2017

Why the function don't work on the string?

#include <iostream>
#include <string>
using namespace std;
void chuli(string a)
{
    a.erase(0,2);
}

int main()
{
    string a = "012345";
    a = chuli(a);
    cout << a; 
}

beginner for C++,i want to know why after this function,this string don't change.Is this something about the namespace?

Aucun commentaire:

Enregistrer un commentaire