I have an array that looks like this:
struct table_elt
{
int id;
char name[];
}
struct table_elt map[] =
{
{123,"elementt1"},
{234,"elt2"},
{345,"elt3"}
};
I am trying to access these elements through map [1] .name, etc. However, it doesn't seem to be able to get the elements correctly, and I get random garbage. I think this is due to the fact that the compiler does not know where the elements will go due to the change. What is the best way to fix this while maintaining greater flexibility and simplicity?
jetru source
share