C can depending on how you structure things be a pain when it comes to arrays.
C++ has vectors (et al) which are super easy to use. One solution in C
(and I stress one solution). Is VLA’s.
The method is to have your array as your last member, then allocate both the space
required for the struct and the array in one shot.
Compile and run,
This kinda feels hackish to me, and I think there are usually better ways, however
its cool to know you can do this.