Is there a way to define a variadic size variable in C?
For example, I want to define a table where both the entries of the table and size of each entry should vary in accordance to the configuration file without recompiling the source code.
To dynamically define the entries of the table, we can use malloc in C or new in C++, but how is the size? I mean something like the below
typedef union {
// the size of x is determined by the configuration file
typeof(x) x;
struct {
// n, m are read from the configuration file when the program is running
typeof(x1) x1: n;
typeof(x2) x2: m;
// Also, the fields should be variadic
... //other_variable
};
};
Thank you very much, and idea please reply me even if you think am ridiculous.