Here is a function:
void foo() {
string str = "StackOverflo";
str.push_back('w');
}
When we declare the string inside the function, is it stored on the Stack or Heap? Why?
string foo() {
string str = "StackOverflo";
str.push_back('w');
return str;
}
Can we return the string reference and continue using somewhere else in the program?