I'm a newbie when it comes to C++ and I have a question.
Can I assign a struct variable to another struct? If so does it have to have the same name and type?
THanks
I'm a newbie when it comes to C++ and I have a question.
Can I assign a struct variable to another struct? If so does it have to have the same name and type?
THanks
what do you mean by that?
You can do something like this
Two different structs can contain the same variable names that doesn't matterCode:struct loser { int Power; }; struct nerd { int Power; }; int main() { nerd me; loser brian; me.Power=10; brian.Power=me.Power; }
Last edited by prog-bman; 07-29-2004 at 09:37 AM.
Woop?
What I mean and sorry for being confusing is can a struct variable be assigned to another in an assignment statement. Do both members of both structs have to have the same name and type?
well they have to be the same type(saying this for simpicity don't kick me anyone) but the names don't have to be the same name.
Woop?
Ok, THanks for your help.