« first day (1481 days earlier)      last day (947 days later) » 

user4202350
7:08 AM
私は疑う
私は疑う
私は疑う
私は疑う
 
1 message moved from Java
 
 
16 hours later…
11:07 PM
Here
struct MyStruct {
std::string label;
};

void exampleFunction(MyStruct state, const char *cString) {
state->label = cString; //copy operator, will this copy survive?
}

int main() {
MyStruct state = new MyStruct();
exampleFunction(myStruct, "whatever");
cout << state->label; // hope this survived
}
ahem, missed a reference
struct MyStruct {
std::string label;
};

void exampleFunction(MyStruct &state, const char *cString) {
state->label = cString; //copy operator, will this copy survive?
}

int main() {
MyStruct state = new MyStruct();
exampleFunction(myStruct, "whatever");
cout << state->label; // hope this survived
}
 
4 messages moved from Lounge<C++>
 

« first day (1481 days earlier)      last day (947 days later) »