VEX struct Q: pass by ref and modify members

   972   1   0
User Avatar
Member
178 posts
Joined: 1月 2013
Offline
Before I go about converting a few thousand lines of C++ code to VEX, I have a question about passing structs as arguments to functions…

If I have a a struct as a function argument, is it passed by reference so I can modify the struct member values within the function?

for example:

void update_marriage_status(userName user; string family_name)
{
  user.last_name = family_name;
}

userName fred = userName("Fred", "Smith");

string married_surname = "Stephens";

update_marriage_status(fred, married_surname);
Edited by jpparkeramnh - 2019年10月5日 22:20:02
User Avatar
Member
178 posts
Joined: 1月 2013
Offline
The answer appears to be yes.
  • Quick Links