Struct issue

I'm trying to use a struct to keep track of all of the player's stats, but the only thing that works is to use an array.
This is fairly clunky and unnecessary, as I only have one.
How can I do this?
This is fairly clunky and unnecessary, as I only have one.
How can I do this?
- Code: Select all
typedef struct playerStructAttributes {
int energy;
int health;
}playerAttributes;
playerAttributes playerstats[1];
//Called from the view when it's created
void setattributes() {
playerstats[0].energy = 0;
playerstats[0].health = 100;
}
//Called from an actor at various points
void addenergy () {
playerstats[0].energy += 5;
}