struct art
{
const char *type;
const char *vaerdi;
};
struct art dyr[] =
{
{"Hund", "0"}, {"Slange", "0"}, {"Kat", "0"},
{"Mus", "0"}, {"Bæver", "0"}, {"Skildpadde", "0"},
{"Løve", "0"}, {"Vædder", "0"}, {"Tiger", "0"}
};
struct art2
{
char type[256];
char vaerdi[256];
};
struct art2 dyr2[] =
{
{"Hund", "0"}, {"Slange", "0"}, {"Kat", "0"},
{"Mus", "0"}, {"Bæver", "0"}, {"Skildpadde", "0"},
{"Løve", "0"}, {"Vædder", "0"}, {"Tiger", "0"}
};
int main()
{
dyr[0].vaerdi = "1"; // Ok
dyr[1].vaerdi[0] = '1'; // NOT Ok
dyr2[0].vaerdi = "1"; // NOT OK
dyr2[1].vaerdi[0] = '1'; // OK
}