Here's an example program in C that defines a structure to store RPG d6 stats:
struct RPGStats {
int strength;
int dexterity;
int constitution;
int intelligence;
int wisdom;
int charisma;
};
int main() {
struct RPGStats stats;
stats.strength = 3;
stats.dexterity = 4;
stats.constitution = 2;
stats.intelligence = 5;
stats.wisdom = 1;
stats.charisma = 6;
printf("Strength: %d\n", stats.strength);
printf("Dexterity: %d\n", stats.dexterity);
printf("Constitution: %d\n", stats.constitution);
printf("Intelligence: %d\n", stats.intelligence);
printf("Wisdom: %d\n", stats.wisdom);
printf("Charisma: %d\n", stats.charisma);
return 0;
}
In this example, we define a structure called RPGStats
that has six integer fields to store d6 stats for a character. In the main()
function, we create an instance of the RPGStats
structure called stats
and initialize its fields with some sample values. Then, we print out each of the field values using printf()
.