#[C] Is there any of setting certain indexs in a const array in a header?

6 messages · Page 1 of 1 (latest)

green thistle
#

Say I have a const array:

static const int example[EXAMPLE_MAX];

and I want to set say the 1002'nd index to the integer value 4, is there a clean way of doing this?

glad umbraBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

green thistle
#

Sorry I should clarify, I mean initialize the value to 4

ripe lantern
#
static const int example[EXAMPLE_MAX] = {
    [1001] = 4,
};```
green thistle
#

ty

#

!solved