News Score: Score the News, Sort the News, Rewrite the Headlines

Writing memory efficient C structs

29 July 2025 by Tom Scheers A struct in C is the best way to organize your data so that you can easily use the data later in your program. However, there are a few caveats to C structures, mainly how their memory works. Our struct struct Monster { bool is_alive; // Used to see whether or not the monster is alive int health; // Health of the monster int damage_hit; // Damage they deal per hit char name[64]; // Name of the monster with a max of 63 characters and one \0, 64 bytes allocated to the s...

Read more at tomscheers.github.io

© News Score  score the news, sort the news, rewrite the headlines