I need an array of strings. The length of a string is known at compile-time and it is crucial that each string takes up this much space. The number of strings on the other hand is only known at runtime. What is the syntax for this?
char* data[STRLENGTH] is incorrect syntax. char** data mostly works but then sizeof(data[0]) is wrong — it should be equal to STRLENGTH.
@Daniel is correct, but this code can confuse people who read it – it’s not something you usually do. To make it more understandable, I suggest you do it in two steps: