Let's begin with actually making a struct.
- Code: Select all
struct PlayerInfo {
int age;
char *name;
};
The ; is important after the }. Now we have created a struct. What you can do NOW is create a second struct and give it the properties of our first struct like so:
- Code: Select all
struct Player1 PlayerInfo;
struct Player2 PlayerInfo;
Now what you can do from there is define seperate information, like this:
- Code: Select all
Player1.name="Bob";
Player1.age=22;
Player2.name="Dave";
Player2.age=25;
See how this works? Hope it helps !