#include <iostream> #include <string> #include <algorithm> using namespace std; int func(std::string str){ cout << "in bef: "<< str << " : " << str.size() << endl; str.clear(); cout << "in aft: "<< str << " : " << str.size() << endl; return 0; } int main() { std::string str("qwertyuiop"); cout << "bef:" << str << " : " << str.size() << " : " << sizeof(str) << endl; func(str); cout << "aft:" << str << " : " << str.size() << endl; return 0; }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more