I have the following struct,
struct example_struct {
int number ;
char word[100]
}
Which I initialize in my code as a constant struct
const struct example_struct example {
.number = 5
} ;
strcpy(example.word, "some_string") ;
which gives me the warning when I try to compile my code:
"warning: passing argument 1 of ‘strcpy’ discards ‘const’ qualifier from pointer target type"
I realize that I shouldn't be trying to assign a value of a struct when I make it a const struct, but I can't put the stringcpy inside the struct either. Is there any way I can assign a string to an element of a const struct in c?