This appears to be a simple problem but I haven’t had any luck searching for any answers so here goes. I have a struct Person with char* name and int age. I have the following method:
void Person_messup(struct Person &who) {
who.name="asdfasdf";
who.age = 9001;
}
compiling this code gives me the following error:
error: expected ; , or ) before & token
I can implement the above just fine using pointers or even passing an object struct but I’m having trouble with this particular implementation. Thanks for the help!
There are no references in c – pass the struct as a pointer.
(or use c++ !)